Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Cetin Basoz
  Where is Cetin Basoz?
 Cetin Basoz
 To: Binod Binani
  Where is Binod Binani?
 Binod Binani
Subject: RE: combo don't display value
Thread ID: 365778 Message ID: 365788 # Views: 55 # Ratings: 1
Version: Visual FoxPro 9 Category: Forms
Date: Monday, December 31, 2012 1:30:46 PM         

> Dear Expert
> I m using a combo box in a form
> in init
WITH this
>   .BoundColumn=2
>   .BoundTo=.t.
>   .ControlSource= "m.ivch_type"
>   .RowSource='tmp_mst_vch.cvch_name, ivch_code'
>   .RowSourceType= 6
>   .Refresh

** Datas of Tmp_mst_vch:
> cVch_name, iVch_Code
> --------------------
> Receipt    1
> Payment    2
> Journal    3
> Contra     4

> By default m.iVch_type=2 ('Payment')
> But when user Select another value from the combo box and moves to another input,
> the the compbo display Blank in stead the value from cVch_name
> I could not follow the reason.
> Please
> *Exchange of $1 Create only $1, But Exchage of one Ideas Makes different two Ideas*

It looks like a bug to me. This works:

Public oForm
oForm = Createobject('myForm')

Define Class myForm As Form
	ivch_type = 2
	Add Object myCombo As ComboBox
	Add Object myText1 As TextBox With Top = 100,Left = 20
	Add Object myText2 As TextBox With Top = 150,Left = 20

	Procedure Load
		** Datas of Tmp_mst_vch:
		Create Cursor tmp_mst_vch (cVch_name c(30), iVch_Code i)
		Insert Into tmp_mst_vch (cVch_name, iVch_Code) Values ("Receipt",    1)
		Insert Into tmp_mst_vch (cVch_name, iVch_Code) Values ("Payment",    2)
		Insert Into tmp_mst_vch (cVch_name, iVch_Code) Values ("Journal",    3)
		Insert Into tmp_mst_vch (cVch_name, iVch_Code) Values ("Contra",     4)

	Procedure myCombo.Init
		With This
			.ControlSource= "thisform.ivch_type"
			.RowSourceType= 3
			.RowSource='select cvch_name, ivch_code from tmp_mst_vch into cursor crsVchType nofilter'

PS: I think it is better to use a property instead of a public var. It would also work with var though.

Cetin Basoz

.Net has got better.Think about moving - check my blog:
My Blog
Blog (mirror) - sounds to be down

Support Wikipedia


combo don't display value Posted by Binod Binani @ 12/31/2012 12:01:41 PM
RE: combo don't display value Posted by Cetin Basoz @ 12/31/2012 1:30:46 PM