Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

326
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda