Results 1 to 2 of 2

Thread: Populate Month in Combobox <Resolved>

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Malaysia
    Posts
    345

    Populate Month in Combobox <Resolved>

    Hi!

    I have a asp.net control combo box. I want to pouplate it with the name of the months.

    I am wring the code in the code behind. I am using vb.net as the code behind.

    My code is

    Code:
     'Month
            dim i as integer
            dim myvar as string
    
            i = 1
            Do While i <= 12
                myvar = MonthName(i, True)
                cboMonth.Items.Add(myvar)
                i = i + 1
            Loop
    I get the populated month names in the combobox, because of the function month name.

    But in the value I want 1,2,3 not Jan, Feb, Mar...How to achive this.

    Had been it ASP I wud have written:

    Code:
    do while iLoop <= 12
        myvar = MonthName(iLoop,true)
          Response.Write "<option value=" & iLoop & " selected>" & myvar & "</option>"
         iLoop = i Loop+1
      loop
    This wud have given me the dsired result.

    How to do in VB.NET?
    Last edited by sinha; Apr 28th, 2005 at 11:31 AM.
    Thanks.

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