Results 1 to 13 of 13

Thread: PocketPC (WM2003) - ComboBox .Text (Resolved)

  1. #1

    Thread Starter
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Resolved 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.

  2. #2
    Addicted Member
    Join Date
    Jan 2005
    Location
    Montréal
    Posts
    160

    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 !

  3. #3

    Thread Starter
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    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.

  4. #4

    Thread Starter
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: PocketPC (WM2003) - ComboBox .Text

    Is there a work around?




    Bruce.

  5. #5
    Addicted Member
    Join Date
    Jan 2005
    Location
    Montréal
    Posts
    160

    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:
    1. ' first add the string to the collection of item
    2. ComboBox1.Items.Add("Hello World")
    3.  
    4. ' then you can 'select it' by setting the text value
    5. 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 !

  6. #6

    Thread Starter
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    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.

  7. #7
    Addicted Member
    Join Date
    Jan 2005
    Location
    Montréal
    Posts
    160

    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 !

  8. #8

    Thread Starter
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    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.

  9. #9
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690

    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

  10. #10

    Thread Starter
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    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.

  11. #11
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690

    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.

  12. #12

    Thread Starter
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    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.

  13. #13
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690

    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
  •  



Click Here to Expand Forum to Full Width