|
-
Jan 16th, 2005, 08:26 PM
#1
PocketPC (WM2003) - ComboBox .Text (Resolved)
Hi Guys,
I have a ComboBox that is loaded with values at Form_Load.
Now, under the click event of a CommandButton, I want to display a string in the ComboBox, so I do:
Me.ComboBox1.Text = "Hello World".
Unfortunatly this dosn't work, the Text is not displayed!
I have successfully tested the code on .Net windows App, but it fails under 'Smart Device Application' (PocketPC WM2003).
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ComboBox1.Items.Add("one")
ComboBox1.Items.Add("two")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
ComboBox1.Text = "Hello World"
End Sub
Bruce.
Last edited by Bruce Fox; Jan 18th, 2005 at 02:56 PM.
-
Jan 16th, 2005, 09:45 PM
#2
Addicted Member
Re: PocketPC (WM2003) - ComboBox .Text
If your DropDownStyle property for the combobox is set at 'DropDownList', then it won't show a text item that is not in it's item collection.
If the DropDownStyle property is set at 'DropDown', or 'Simple', then you can set the text property of the combobox with any text you want.
There are no stupid questions, but a whole bunch of dumb sayings !
Save time on database code, try DataLG !
-
Jan 16th, 2005, 10:03 PM
#3
Re: PocketPC (WM2003) - ComboBox .Text
Thanks sixfeetsix,
I couldn't find that .property, so I tried to edit the 'Region' and realsied
that 'DropDownList' is the ONLY option for 'Smart Device Application'.
No doubt its available via VB.Net!
Cheers,
Bruce.
-
Jan 17th, 2005, 02:58 PM
#4
Re: PocketPC (WM2003) - ComboBox .Text
Is there a work around?
Bruce.
-
Jan 17th, 2005, 04:17 PM
#5
Addicted Member
Re: PocketPC (WM2003) - ComboBox .Text
If what you wrote earlier is correct :
realised that 'DropDownList' is the ONLY option
then you must add the item in the collection of the combobox before you set to the text value property.
VB Code:
' first add the string to the collection of item
ComboBox1.Items.Add("Hello World")
' then you can 'select it' by setting the text value
ComboBox1.Text = "Hello World"
I don't see another workaround for this.
There are no stupid questions, but a whole bunch of dumb sayings !
Save time on database code, try DataLG !
-
Jan 17th, 2005, 06:53 PM
#6
Re: PocketPC (WM2003) - ComboBox .Text
Hi again,
I didn't want to add that item, just dispay it as Text in the Combo.
The problem can be seen using the code I provided, in VB.Net it's fine, but when run on my PocketPC or as an Emulator it has no effect.
I'm gussing it's a limitation of the .Net Framework for 'Smart Devices'.
Bruce.
-
Jan 18th, 2005, 12:20 AM
#7
Addicted Member
Re: PocketPC (WM2003) - ComboBox .Text
I did a little research for you, and it turns out that the only value supported in the .NET Compact Framework for the ComboBox.DropDownStyle property is "DropDownList".
This would explain why you MUST ADD the text string in the collection of items before you can set the Text property to that same string value.
Here is the link to msdn where I found that info:
http://msdn.microsoft.com/library/de...classtopic.asp
Notice that the only value for ComboBoxStyle Enumeration that is supported in the Supported by the .NET Compact Framework is "DropDownList"; the description for the "DropDownList" value is :
The user cannot directly edit the text portion. The user must click the arrow button to display the list portion.
Hope this clears it out a bit
There are no stupid questions, but a whole bunch of dumb sayings !
Save time on database code, try DataLG !
-
Jan 18th, 2005, 02:54 PM
#8
Re: PocketPC (WM2003) - ComboBox .Text
Thanks sixfeetsix,
I figured it was a limitation. I made that point about the "'DropDownList' is the ONLY option for 'Smart Device Application'." in my second post, so makes sense now.
Honestly, I thought this side of .Net was going to be a great step up from embeddedVB - go figure 
Thanks again,
Bruce.
-
Jan 18th, 2005, 03:06 PM
#9
Frenzied Member
Re: PocketPC (WM2003) - ComboBox .Text (Resolved)
If you want to have some fun with the compact framework, head on over to opennetcf.org and check out, among other things, the ComboBoxEx class. Might be just what the doctor ordered
-
Jan 18th, 2005, 03:45 PM
#10
Re: PocketPC (WM2003) - ComboBox .Text (Resolved)
Thanks Mike, I'll take alook 
(Just a pitty something so simple (and not nessacceraly essential) was overlooked/left out)
Cheers,
Bruce.
-
Jan 18th, 2005, 03:49 PM
#11
Frenzied Member
Re: PocketPC (WM2003) - ComboBox .Text (Resolved)
Yeah, that's true. It can be frustrating sometimes using the CF because of the limited functionality. More than likely though, someone has already filled in the gaps.
-
Jan 18th, 2005, 04:52 PM
#12
Re: PocketPC (WM2003) - ComboBox .Text (Resolved)
I decided to port across a eVB app and also delve into .Net (albeit CF) 
I notice there are still hangover issues, eg the FileOpen dialog using initDir.
As a side note, there isnt to much out there at the moment on WM2003; 'devbuzz.com' is certainly one option and the site you posted.
Maybe VBF needs a CF Forum .
Bruce.
-
Jan 18th, 2005, 11:58 PM
#13
Frenzied Member
Re: PocketPC (WM2003) - ComboBox .Text (Resolved)
There's a Mobile Development forum, but there's not a whole lot of traffic.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|