Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing the rowsource of a combobox during active sessi
Message
 
To
29/10/2006 11:44:18
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01165371
Message ID:
01165375
Views:
14
>Hi all,
>
>Would anyone know how to programatically change the rowsource of a combobox during an active session?
>I have been using code like
>
>CASE lcfield="copr"
>	lccontrol.rowsourcetype=6
>	lccontrol.rowsource="Opr.op_code"
>Endcase
>
>Where lccontrol is the combobox. Have been trying for a couple of hours, but no luck yet.
>
>Regards,
>
>Steve.

Hi Steve,
Try this code
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN


	**************************************************
*-- Form:         form1 (e:\ut\form1.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   10/29/06 07:24:09 PM
*
DEFINE CLASS form1 AS form


	Top = 0
	Left = 0
	Height = 152
	Width = 375
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"


	ADD OBJECT lccontrol AS combobox WITH ;
		RowSourceType = 6, ;
		RowSource = "", ;
		Height = 25, ;
		Left = 59, ;
		Style = 2, ;
		Top = 27, ;
		Width = 257, ;
		Name = "lccontrol"


	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 71, ;
		Left = 76, ;
		Height = 48, ;
		Width = 208, ;
		WordWrap = .T., ;
		Caption = "Change the rowsource of a combobox during...", ;
		Name = "Command1"


	PROCEDURE Load
		CREATE CURSOR Opr (Op_code c(20), Myvalue I)
		INSERT INTO Opr VALUES ("50 50",50)
		INSERT INTO Opr VALUES ("60 60",60)
		INSERT INTO Opr VALUES ("70 70",70)
		INSERT INTO Opr VALUES ("80 80",80)
	ENDPROC


	PROCEDURE command1.Click
		ThisForm.lccontrol.RowSourceType = 6
		ThisForm.lccontrol.RowSource = [Opr.op_code]
		ThisForm.Command1.Enabled = .f.
	ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
Where is the problem?
_______________________________________________________________
Testing displays the presence, not the absence of bugs.
If a software application has to be designed, it has to be designed correctly!
_______________________________________________________________
Vladimir Zografski
Systems Analyst
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform