Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SelText Function on a ComboBox
Message
From
22/03/2000 11:29:27
 
 
To
22/03/2000 11:07:01
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00348927
Message ID:
00348945
Views:
22
>Hi,
>
>I have a problem with the SelText function. I want to read the value chosen by the user once that user hits the "OK" button incorporated on a form. The problem is that even if the user chooses a valid value from the ComboBox object (called day_box here), SelText returns the empty String. Here is a parcel of my code if it helps:
>
>Private Sub btnOk_Click()
>Dim DateSend As String
> If (day_box.SelText <> "") Then
> DateSend = Principal.myFormat(CreateDate)
> Principal.currentForm.Visible = False
> 'More code here
> Else
> MsgBox ("Please choose a day!")
> End If
>End Sub
>
>I always get the "Please choose a day" message!
>
>Is it something I'm doing wrong or is it only because I'm not using the correct function for what I want to do? Is there any other way to read the option chosen by a user from a ComboBox?
>
>I know that it must be something really stupid but I can't seem to find what.
>
>Thanks in advance, Steph.

This is VB code so I'm assuming this is in VB. Haven't looked at VB combos in a while but I don't think you should be testing on the SelText property. I believe it should be the Value property, something like:
If (day_box.Value <> "") Then
...
You're trying to verify that the user selected a Value in the combo, not highlighted text. This is off the top of my head so if "Value" isn't the right property, you should be able to determine it, or maybe someone with ready knowledge of VB combos will jump in with the exact info.

Bill
William A. Caton III
Software Engineer
MAXIMUS
Atlanta, Ga.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform