2
Answers

Read header row in datatable into combobox

Charlie

Charlie

12y
2.2k
1

Hi all,

Hoping someone might be able to point me in the right direction.

I have a winforms application that imports data from a csv file into a datatable. I now need to read the header row from the datatable & use that as a list in a combobox. Any ideas as I'm stuck on howto do this.

Many thanks

Charlie

Answers (2)
0
kalu singh rao

kalu singh rao

NA 6.4k 63.9k 8y
You can check by this code
 
Method 1
 
if(!String.IsNullOrEmpty(txtContent.Text)){
// it is true
}
else
{
 // it is false
}
 
Method 2
 
 if(txtContent.Text != "")
{

}
 
Method 3

if (txtContent != string.Empty)
{

}
 
Accepted
0
Nilesh Sawardekar

Nilesh Sawardekar

NA 1.4k 15.2k 8y
Hello,
Thanks for accepting answer. For new question, ask same in new. with your code.
0
Joma Alrzini

Joma Alrzini

NA 61 7.9k 8y
thanks Kalu and Nilesh
I works fine but in my code above when I click on the button to submit to database the whole page is refreshed I do need to stop that I tried with updatepanel but I could not I read about ajax but I have no idea how to do it
please help me it f you have any example
I appreciate that very much
0
Nilesh Sawardekar

Nilesh Sawardekar

NA 1.4k 15.2k 8y
if you want to restrict user from saving when txtcontent is null then you can use validation control, else write your query in if (txtContent.text !="").