469,955 Members | 2,576 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,955 developers. It's quick & easy.

C# Autocomplete textbox using excel as a database?

So I am creating a windows form application that has a autocomplete text box. I want the text box to pull data from an excel spreadsheet. How would I go about doing this? I noticed that you cannot transfer the items from a multideminsional into the text box, however, that is the only way I know how to pull the data from excel. Any suggestions?
Feb 19 '19 #1
2 10012
1,044 Expert 1GB
Show your example code, and if you can transfer items from a 'multideminisional' (probably you mean multidimensional) , you should already have enough knowledge.
Because 1 row, of 1 columns, is also multidimensional.
Even 1 cell is multidimensional, it has a width, and a height.
Apr 22 '19 #2
3 2Bits
To read data from Excel worksheet, you'll need to use an Excel library, such as Free Spire.XLS for .NET.

The following code example shows you how to export data from excel to datatable using it. Then you could traverse the items in the datatable and insert them into your textbox.
Expand|Select|Wrap|Line Numbers
  1. //Create a new workbook
  2. Workbook workbook = new Workbook();       
  3. //Load excel file
  4. workbook.LoadFromFile(@‪C:\Users\Administrator\Desktop\Data.xlsx);          
  5. //Get first worksheet
  6. Worksheet sheet = workbook.Worksheets[0];
  7. //Export to datatable
  8. DataTable dataTable = sheet.ExportDataTable();
2 Weeks Ago #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Juan Sanchez | last post: by
14 posts views Thread by pmud | last post: by
5 posts views Thread by Mike in Santa Rosa | last post: by
8 posts views Thread by nil | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.