Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Mobile
  4. Create Button and his event

Create Button and his event

Scheduled Pinned Locked Moved Mobile
csharpcomhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Khatri Mitesh
    wrote on last edited by
    #1

    Hi I want to create button at run time in win mobile using vb.net 2005. and i want to create event also at run time. Please suggest. i write the following code...

    dim btn as button
    For i As Integer = 0 To 5
    btn = New Button
    btn.Text = sAppointmentTypes(i)
    btn.Tag = sAppointmentTypesIds(i)
    btn.Height = Label1.Height
    btn.Left = Label1.Left
    btn.Width = Label1.Width
    btn.Top = Label1.Top + (Label1.Height * i + 1) + 50
    'AddHandler btn.Click, AddressOf btn.Click
    AddHandler btn.Click, AddressOf Me.ClickButton
    Me.Controls.Add(btn)
    Next

    Private Sub ClickButton(ByVal sender As System.Object, ByVal e As System.EventArgs)
    msgbox sender.text
    End Sub

    it shows the error in sender.text. Please suggest how i do this. Thanx

    ~Khatri Mitesh khatrimitesh@hotmail.com Bikaner (Rajasthan) INDIA

    F 1 Reply Last reply
    0
    • K Khatri Mitesh

      Hi I want to create button at run time in win mobile using vb.net 2005. and i want to create event also at run time. Please suggest. i write the following code...

      dim btn as button
      For i As Integer = 0 To 5
      btn = New Button
      btn.Text = sAppointmentTypes(i)
      btn.Tag = sAppointmentTypesIds(i)
      btn.Height = Label1.Height
      btn.Left = Label1.Left
      btn.Width = Label1.Width
      btn.Top = Label1.Top + (Label1.Height * i + 1) + 50
      'AddHandler btn.Click, AddressOf btn.Click
      AddHandler btn.Click, AddressOf Me.ClickButton
      Me.Controls.Add(btn)
      Next

      Private Sub ClickButton(ByVal sender As System.Object, ByVal e As System.EventArgs)
      msgbox sender.text
      End Sub

      it shows the error in sender.text. Please suggest how i do this. Thanx

      ~Khatri Mitesh khatrimitesh@hotmail.com Bikaner (Rajasthan) INDIA

      F Offline
      F Offline
      funklet
      wrote on last edited by
      #2

      Private Sub ClickButotn(ByVal sender as Object, Byval e as EventArgs)
      Dim b as New Button = DirectCast(sender,Button)
      messagebox.show(b.text)
      End Sub

      Hope this helps.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups