2 Replies - 3111 Views - Last Post: 08 April 2010 - 03:31 AM Rate Topic: -----

#1 sougias  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 37
  • Joined: 28-October 09

Runtime control a radioButton

Posted 08 April 2010 - 02:40 AM

Hello again.
After searching the google am not be able to find something to help me out.
I wont to built a web player i broke down the project in pieces so i can be more efficient.
Project info:
The user has 4 default station (4 radiobutton).From menuStrip can add a station.This is a run time control that add a new radiobutton on FlowLayoutPanel.It has a text like the user wont it.
The user can add as many station as he like.
The problem:
I can be able to insert in radiobutton the proper text .How i can make after user check the radiobutton and push button Listen to load the url value and play.(i know after that RadioPlayer.URL = xxxx ).
I be aware for clik event addressOf and for a dynamical used array but nothing help me out to take the url value and connect to the radiobutton.
Target:
After user add a station ,he can check the station and after push the Listen! button can listen .
Conclusion
This is only the part of the project. It is broke there so it is more clear and easy to help me.This not only for me but everyone search in google or in site.Runtime control item and handles the value.

Hope for the best :)


Form1
Public Class Form1


    Private Sub AddToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddToolStripMenuItem.Click
        Form2.Show()
        Me.Hide()
    End Sub

End Class


Form 2
Public Class Form2

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim nameOfStation As String, stationUrl As String
        nameOfStation = TextBox1.Text
        stationUrl = TextBox2.Text

        Dim c As New RadioButton()
        c.Location = New Point(112, 79)
        c.Text = nameOfStation
        Form1.FlowLayoutPanel1.Controls.Add(c)
        Me.Hide()
        Form1.Show()
    End Sub
End Class

Attached image(s)

  • Attached Image
  • Attached Image
  • Attached Image

This post has been edited by sougias: 08 April 2010 - 02:43 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Runtime control a radioButton

#2 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1057
  • View blog
  • Posts: 4,092
  • Joined: 02-July 08

Re: Runtime control a radioButton

Posted 08 April 2010 - 03:17 AM

You store the name of the station as text, the URL in the Tag property. Use the Addhandler statement to point to a Sub that handles the event for you:
'add this where you create it
Addhandler c.CheckChanged, AddressOf c_CheckChanged

Private Sub c_CheckChanged(Sender as object, e as eventArgs)
  labelNowPlaying.Text = DirectCast(Sender, RadioButton).Text
  URL = DirectCast(Sender, RadioButton).Tag.ToString
End Sub

Was This Post Helpful? 1
  • +
  • -

#3 sougias  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 37
  • Joined: 28-October 09

Re: Runtime control a radioButton

Posted 08 April 2010 - 03:31 AM

All fixed now.Thank you for your help.
I was so close to solve that. only the
 URL = DirectCast(Sender, RadioButton).Tag.ToString
;)
Thank you again you help me a lot :)

This post has been edited by sougias: 08 April 2010 - 04:27 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1