I have used this code in ASP.NET. what is the same for VB.Net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • surakshithraip
    New Member
    • Jul 2010
    • 1

    I have used this code in ASP.NET. what is the same for VB.Net

    Code:
    Public Sub FillDdl(ByVal str1 As String, ByRef dt As Data.DataTable, ByVal ddl As ComboBox)
            Try
                cmd.CommandText = Data.CommandType.Text
                cmd.CommandText = str1
                da.SelectCommand = cmd
                da.SelectCommand.Connection = con
                dt.Rows.Clear()
                da.Fill(dt)
                If dt.Rows.Count > 0 Then
                    Dim dv As New Data.DataView(dt)
                    ddl.DataSource = dv
                    ddl.DataTextField = "Name"
                    ddl.DataValueField = "Code"
                    ddl.DataBind()
                End If
            Catch ex As Exception
            End Try
        End Sub
    Im getting error in this section:
    Code:
                    ddl.DataTextField = "Name"
                    ddl.DataValueField = "Code"
                    ddl.DataBind()
    Last edited by Niheel; Jul 23 '10, 08:44 AM. Reason: more details to question
  • PsychoCoder
    Recognized Expert Contributor
    • Jul 2010
    • 465

    #2
    Well the VB.NET you use with ASP.NET is the same as you would use for a WinForms application. Without knowing the exact error message you're receiving it's nearly impossible for us to help formulate a resolution ;)

    Comment

    Working...