By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,960 Members | 1,488 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,960 IT Pros & Developers. It's quick & easy.

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

P: 1
Expand|Select|Wrap|Line Numbers
  1. Public Sub FillDdl(ByVal str1 As String, ByRef dt As Data.DataTable, ByVal ddl As ComboBox)
  2.         Try
  3.             cmd.CommandText = Data.CommandType.Text
  4.             cmd.CommandText = str1
  5.             da.SelectCommand = cmd
  6.             da.SelectCommand.Connection = con
  7.             dt.Rows.Clear()
  8.             da.Fill(dt)
  9.             If dt.Rows.Count > 0 Then
  10.                 Dim dv As New Data.DataView(dt)
  11.                 ddl.DataSource = dv
  12.                 ddl.DataTextField = "Name"
  13.                 ddl.DataValueField = "Code"
  14.                 ddl.DataBind()
  15.             End If
  16.         Catch ex As Exception
  17.         End Try
  18.     End Sub
  19.  
Im getting error in this section:
Expand|Select|Wrap|Line Numbers
  1.                 ddl.DataTextField = "Name"
  2.                 ddl.DataValueField = "Code"
  3.                 ddl.DataBind()
  4.  
Jul 23 '10 #1
Share this Question
Share on Google+
1 Reply


PsychoCoder
Expert Mod 100+
P: 465
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 ;)
Aug 1 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.