DropDown's DataSource/DataMember

  • Thread starter Thread starter John Spiegel
  • Start date Start date
Greg,

You are right as well about the webpage, I tested it, I saw there was a
little error in my windowform sample that you corrected in your test.
Therefore I show both samples now.

The Windowform sample in VBNet which "has to" be case sensitive and
therefore goes wrong and a webform sample in C# which maybe case insensitive
and therefore goes right.


\\\VBNet case sensitive windowform needs 2 comboboxes on a form
Private Sub Form11_Load(ByVal sender _
As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dt As New DataTable
dt.Columns.Add("Greg")
For i As Integer = 0 To 9
Dim dr As DataRow = dt.NewRow
dr(0) = i.ToString
dt.Rows.Add(dr)
Next
ComboBox1.DataSource = dt
ComboBox2.DataSource = dt
ComboBox1.DisplayMember = "Greg"
ComboBox2.DisplayMember = "greg"
End Sub
///
\\\Case insensitive C# needs 2 dropdownlists on a form
private void Page_Load(object sender, System.EventArgs e)
{
DataTable dt = new DataTable();
dt.Columns.Add("Greg");
for (int i = 0; i < 10;i++)
{
DataRow dr = dt.NewRow();
dr[0] = i.ToString();
dt.Rows.Add(dr);
}
DropDownList1.DataSource = dt;
DropDownList2.DataSource = dt;
DropDownList1.DataTextField = "Greg";
DropDownList2.DataTextField = "greg";
DropDownList1.DataBind();
DropDownList2.DataBind();
}
///

Real weird is it not?

Cor
 
Back
Top