Home > Net >  VB.NET how RadioButton implementation choice, the corresponding text box content in real time
VB.NET how RadioButton implementation choice, the corresponding text box content in real time

Time:11-20

Want to achieve after choosing any one province, the contents of a text section shows real-time change

CodePudding user response:

Writing in the click
If ctype (sender, RadioButton.) Ckecked=True then
TextBox1. Text=ctype (sender, RadioButton.) the Text

CodePudding user response:

Here is like that, I have 31, is a click each button to add the trigger

CodePudding user response:

The comboBox, a local

CodePudding user response:

Can write with the parameters of the object in a click sender judgment which selected

CodePudding user response:

Can you give me the reference code

CodePudding user response:

 

Public Class Form1

Private Sub Form1_Load (ByVal sender As System. Object, ByVal e the As System. EventArgs) Handles MyBase. Load
'all RadioButton within enumeration GroupBox1
'will CheckedChanged events are bound to the Group1_RadioButton_CheckedChanged function
For Each Item As Control In GroupBox1. Controls,
If the Item. GetType=GetType (RadioButton) Then
AddHandler TryCast (Item, RadioButton). CheckedChanged, AddressOf Group1_RadioButton_CheckedChanged
End the If
Next
End Sub

'all RadioButton CheckedChanged events within the group in response to this
Private Sub Group1_RadioButton_CheckedChanged (ByVal sender As System. Object, ByVal e the As System. EventArgs)
TextBox1. Text=TryCast (sender, RadioButton.) Text
End Sub

The End of the Class

  • Related