Click here to Skip to main content
15,919,931 members

Comments by himanil (Top 1 by date)

himanil 16-Sep-17 9:26am View    
hi thanks for reply, Actually I need to implement following things:
1. The user can load any Excel File from which he want to add data on fields like Labels.
2. The Excel will be loaded into Dataset and Dataset will be loaded in DataGridview. So he can see his Excel file.
3. User can then type the Column names in textboxes from which he needed Information to be added on Form, This will facilitate to add specific Columns information not all the colums because in one Excel sheet he can have 5 columns useful and in other Excel he might have 10 Columns useful only.
4. Whatever Column name he typed in Textboxes, The cells value will be added to corresponding Labels in Form. So this will like Choose which columns data you want to display and facilitate user in more friendly way.

I had implemented this process till Step 2 successfully but in next step if I try to define code for lets sake 15 Labels only. So what I did I wrote the above code 15 times changing only label and Textbox ids to map maximum 15 labels with 15 columns by 15 Textboxes.
But the problem I am facing is if I as a user at this time leaves any of the textbox as Blank which means I might have selected 9 columns then C# throws an error like, ' ' is not found in dataset.
I am figuring out how to solve this.

Hope this will make my situation clear and helps you or others to find a solution for this problem and I know Codeproject users can Code anything.

Thanks and Warm Regards