Selected Item in a Dropdown

G

Guest

Hi,

I'm trying to create a function that will show the current value of a
datagrid when you go into the edit mode of the datagrid. At the moment when
ever I hit edit it just shows me a list of values in the dropdown list with
the default selected value always chosen, rather than the actual value shown
in the datagrid.

I would really appritiate any help!

Thanks

...:: CODE

Function GetSelectedIndex(ByVal OID As String) As Integer

Dim Myconn As New
SqlConnection(ConfigurationSettings.AppSettings("strConn"))
Dim cmd As New SqlCommand("SelectOffice", Myconn)
cmd.CommandType = CommandType.StoredProcedure

Myconn.Open()

Dim myReader As SqlDataReader = cmd.ExecuteReader()
'Populate the reader
If myReader.HasRows Then
Do While myReader.Read()
Console.WriteLine(vbTab & "{0}" & vbTab & "{1}",
myReader.GetInt32(0), myReader.GetString(1))
Loop
Else
Console.WriteLine("No rows returned.")
End If
myReader.Close()

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top