Input data into a textbox and output into a datagridview?
I am COMPLETELY new to all of this so excuse my simple mind! I am doing some practice and one of the examples is to create a program in C# where information for at least 10 employees is entered. So each employee has ID, name, surname and salary.
I decided to use a gridview to display the data and created a class called Employee and I have constructors and methods.
My question is how do I get what I put into the textboxes to come out to the gridview? I'm completely confused :( Sorry if it's v. simple
I'm using VB 2010 btw. Thanks for any help! :thumb:
Re: Input data into a textbox and output into a datagridview?
Quote:
Originally Posted by
scheine
I am doing some practice and one of the examples is to create a program in C#
Quote:
Originally Posted by
scheine
I'm using VB 2010 btw
I just want to make absolutely sure that you really are using VB and not C#.
Re: Input data into a textbox and output into a datagridview?
OH sorry I'm using Visual Studio! It has to be in C#, sorry. My mind is frazzled
Re: Input data into a textbox and output into a datagridview?
In that case I'll ask the mods to move this thread from the VB forum to the C# forum.
Re: Input data into a textbox and output into a datagridview?
Thank you, sorry for that!
Re: Input data into a textbox and output into a datagridview?
Thread moved from the 'VB.Net' forum to the 'C#' forum
(thanks for letting us know jmcilhinney :thumb: )
Re: Input data into a textbox and output into a datagridview?
What code do you have so far?
Are you storing the data in a DataTable and binding the DataGridView to that or just trying to add the data directly to the DataGridView?
Re: Input data into a textbox and output into a datagridview?
Now that we're in the correct forum, can we have some more specific details? I'm guessing that the idea here is that you enter data into some TextBoxes and then click a Button and the data is added to the grid as a new record. Correct?
Re: Input data into a textbox and output into a datagridview?
You can query the Class properties. I would create an array or list of the class for Employees, and then for each, display into the DataGridView.
You can easily do this by making it your datasource.