Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
My List Box won't return '0' when selected from my list
Message
 
To
03/06/2002 14:18:10
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00664193
Message ID:
00664210
Views:
31
>Hi there,
>
>I'm working on an application written in VFP 5.0. I have a list box on one of the forms, and on the INIT procedure, I have the following:
>
>with this.lstComp
> .AddListItem('0',1)
> .AddListItem('1',2)
> .AddListItem('2',3)
> .AddListItem('3',4)
> .AddListItem('4',5)
> .AddListItem('5',6)
> .AddListItem('6',7)
> .AddListItem('7',8)
> .AddListItem('8',9)
> .AddListItem('9',10)
>endwith
>
>But when I run the application in debug and select the '0' choice, the listbox.value = "". Whenever I choose one of the other selections (1-9), listbox.value equals the selection I chose.
>
>Any ideas how I can get my listbox.value and selcting '0' to work correctly?
>
>Thanks,
>

Joe, I just created the form in VFP 5 and put your code there, an it correctly shows "0" in Watch window for _screen.activeform.lstcomp.value
What is your setting for the RowSourceType?

Here is teh code from the Class Browser:
**************************************************
*-- Form:         form1 (c:\prg\test\formjunk2.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*
DEFINE CLASS form1 AS form


	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"


	ADD OBJECT lstcomp AS listbox WITH ;
		Height = 180, ;
		Left = 36, ;
		Top = 36, ;
		Width = 192, ;
		Name = "lstComp"


	PROCEDURE Init
		with this.lstComp
		.AddListItem('0',1)
		.AddListItem('1',2)
		.AddListItem('2',3)
		.AddListItem('3',4)
		.AddListItem('4',5)
		.AddListItem('5',6)
		.AddListItem('6',7)
		.AddListItem('7',8)
		.AddListItem('8',9)
		.AddListItem('9',10)
		endwith
	ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Reply
Map
View

Click here to load this message in the networking platform