Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

316
Views
How can I write to a textbox in C#, having a bindingSource?

This is my code in C# with Visual Studio 2019:

private String[] getClientData(String clientName)
{
    DataTable table = labelPrinterDBDataSet.Tables["clients"];
    DataRow[] datatable = table.Select("name = '" + clientName + "'");

    if (datatable.Length > 0)
    {
        DataRow row = datatable[0];
        String[] data = new String[row.ItemArray.Length];

        for (int i = 0; i < row.ItemArray.Length; i++)
        {
            data[i] = row.ItemArray[i].ToString();
        }
        return data;
    }
    else
    {
        return new string[0];
    }
}

private void nameListBox_SelectedIndexChanged(object sender, EventArgs e)
{
    textBox1.Text = nameListBox.GetItemText(nameListBox.SelectedItem);

    clientData = getClientData(textBox1.Text);

    textBox1.Text = clientData[1];
    textBox2.Text = clientData[2];
}

The listBox is with a bindingSource.

When I run my program, it does allow me to write to the textBox, but if I select something from the listBox, I can no longer write to the textBox.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

After doing some research, it appears to be the causesValidation property but I don't know exactly why. I changed it from true to false and the problem was solved.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!