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.
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.
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.
Re: PocketPC (WM2003) - ComboBox .Text
Is there a work around?
Bruce.
Re: PocketPC (WM2003) - ComboBox .Text
If what you wrote earlier is correct :
Quote:
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.
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.
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 :
Quote:
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
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.
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 :)
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.
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.
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.
Re: PocketPC (WM2003) - ComboBox .Text (Resolved)
There's a Mobile Development forum, but there's not a whole lot of traffic.