How to Import Excel into DataGridView Visual Basic

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to our channel triple w dot news article shot ID hey what's up guys maybe any new senses you know okay and this is where i'm gonna show how to import microsoft excel to get a great feel in official basic first we need to create one project here let's do to create a project I will put my project inter desktop and then give the name is import Excel into data grid view vb.net okay then I click OK before we decide to code I want to explain shortly if in this tutorial we need Microsoft Office installed on our computer in this case I'm using Microsoft Office 2007 because we need to using Microsoft Excel object library surfaces to reference in our project now let's add just quits view and then I need button ok this is data grid view one just bring him to sort tiki few one like this okay this is for button let's just change the type to import Excel like I said just know we need to add Microsoft Excel object library as reference because we need using Microsoft Excel services just right-click on the project at difference I want to search Excel object library I will add Microsoft Excel 12.0 object library in here and then I will click OK ok now let's try to cut in here ok double click in button and I'm using try in here because this comment is high or is error so I recommend that you using try exception ok you can see here you can see a potential fixes and then import system data led be just a quick like this scale and I want to declare open file file dialogue to find the location of our Excel document open file dialog sorry danyoung like here as new Open File dialog then let's to make up and file dialog to initial directory computers Frances so while the Open File dialog is fine the Excel document first will open in the document in our computers this is the pet in here guys okay document in here now we need to filter the just excel file will show okay I want to using all files you can just do it specified actual but in here I want also to show all file in the pet so any extension without showing and this is for Excel special Excel files okay and number second we can also doing with XLS files in other difference or other extension for Excel format okay this is for extension dot XLS this is for extension okay like this now this is filter while the Open File dialog is open - if Open File dialog but I'm sorry that's your dialog this is me is equal to system okay if Open File dialog show dialog let me is equal to okay it's mean the user click open or okay guys and agree with in the selected file we need to declare some file information in here as new hi odo file info okay this is for our connection to declare con equal to new woody DB connection okay this is for provider provider equal to Microsoft twelve point zero and data source equal to X oh yeah okay and then for extended properties extend it Excel twelve point zero in here okay ten here see like Asterix from its mean all lies okay from this is the seed name in here is it one okay now break it in here again mistake here then just remove liquid don't fill DTS its comma in here for sheet one for Datak if you won the datasource equal to TDS and for let's a quick few one data member is equal to c1 here like this and don't forget to close the connection and then for exception is con no no no no sorry X it's up don't forget guys you can also add in conduct close if there is nothing in here just exits up okay it's better to declare this not in try you can do like this so you can close the connection if something error okay let's try you okay guys you can see here let's make one excel file in the X stop let's call data by news and see for example let's make five data here for example this is number web name channel Facebook and then the last is for example just description like this okay for example this is 1/2 then noose NC or a P C or like this guy's 4 different 1 B 2 like this okay then for channel is for example news and YouTube Facebook news in see Facebook description subscribe us okay I want to make number here so for example X data it's dummy data for our experiment okay you can because you can make the header it's different color let's close this guys and let's try to import this into data grid view I hope this is not nothing error okay data by new CNC let's see like okay guys it's very nice okay if your data grid view no outer size like this you can auto size column to fill like this and then try again you can see like this okay you can see here guys it's works if you want to docking using enter you can do like this for example right and then bottom so your data if you will more beautiful here okay just import Excel go to desktop and data by new scenes okay I think it's enough how to import data using Excel to delegate view in fees all basic document okay don't forget to subscribe I want to show also how to inserting data grid view item in MySQL and then how to export also so it's very very nice for you if you know about this method okay I think's enough you can download this project in my website in WWE you start coded ID slice web sites UV all project you can download here our project here okay thanks for watching guys I hope this helpful you bye bye
Info
Channel: Nosware
Views: 34,031
Rating: 4.889401 out of 5
Keywords: Tutorial, Programming, Visual Basic, VB.NET, Import Export Excel VB.NET, .NET
Id: UyDSGkjOB6E
Channel Id: undefined
Length: 18min 22sec (1102 seconds)
Published: Mon Mar 19 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.