I think the solution to your problem is quite simple, but I cannot be sure because your code snippet is so badly formatted that it is difficult to read. Next time you post some code please use the 'code block' widget (below the Text: box). Put the cursor on a new line, click the 'code block' and then paste your code between the opening and closing tags. That way all of your formatting etc. will be retained, making it easier for people to read and therefore more likely that you will get a response. OK, lecture over. To solve your problem, whilst using your existing code, modify your RadioButton2_CheckedChanged method like this:
Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
TStudentId.Visible = True
StudentId.Visible = False
Button1.Visible = False
Button2.Visible = True
Button3.Visible = True
Dim i As Integer
Dim da As New SqlDataAdapter
Dim ds As New DataSet
Dim dt As New DataTable
TStudentId.Items.Clear() '<========================= HERE'S the change, get rid of the old stuff before adding the new
Conn.Open()
Cmd = Conn.CreateCommand
Cmd.CommandText = "Select StudentId from Student"
da.SelectCommand = Cmd
da.Fill(ds, "Student")
dt = ds.Tables("Student")
For i = 0 To dt.Rows.Count - 1
TStudentId.Items.Add(dt.Rows(i).Item(0))
Next
Fname.Text = ""
Lname.Text = ""
Address.Text = ""
Mobile.Text = ""
EmailId.Text = ""
Conn.Close()
End Sub
But I have to ask. Why not just set TStudentId.DataSource to dt, rather than use the For..Next loop as you do? Another lecture coming up, sorry! :) For your own peace of mind, do try to stop using silly member names (da for a DataAdapter, dt for a DataTable), sure you remember what they do now, but in six months you won't. And what are you going to do when you need more than one DataAdapter, use da2? Instead of dt, how about StudentIdTable, or tblStudentID, and so on. Also RadioButton2, what does it do? Again you know now, but in six months?? And more importantly in this case It took me a lot more reading to work out what was going on than it should have done. Give all members and controls (with the possible exception of Labels) sensible descriptive names. How about rbtnShowId for example 'rbtn' tells me it is a RadioButton 'ShowId' tells me that it shows/hides the Id Dropdown, devise your own naming scheme and stick t