Click here to Skip to main content
15,886,095 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have already created a DataGridView table for my UI. I would like it so the headings and formatting stays as it is, but simply when a Row is populated, the information to the stored in a local database (or potentially just to a file if its simpler, I just want the inputted information to be there whenever I start the solution). How can I achieve this?

The data gets inputted from textboxes along with a combo-box and datetimepicker, and when a button is pressed, the information gets printed into a row. I would like it so just the rows simply go into a database or file, without messing up the formatting.

Please ask for clarity if needed.
THANKS!!!

What I have tried:

        Dim dgvGeneralRow As Object() = New Object() {Nothing, txtTaskName.Text, txtTaskTag1.Text, cmbPriority.SelectedItem.ToString(), dateDUE.Value.ToString(), txtLink.Text, txtNoteEntry.Text}
        
dataGVGeneral.Rows.Add(dgvGeneralRow) 
The Code above, allows for the textbox, combobox and datepicker entry to be added to the relevant columns of my already made DataGridView.

I want it so the data entered writes to a file (read and write), or so the data entered gets placed within a local database.

I want to be able to move certain rows of the DataGridView to another DataGridView in another form. What will be the best way?
Posted
Updated 8-Jul-20 22:57pm
v2
Comments
Andre Oosthuizen 9-Jul-20 3:28am    
Please show some code to better understand your question.
Shaheer Rizwan 9-Jul-20 3:51am    
I have added the code I used, and what I want to achieve exactly
Richard MacCutchan 9-Jul-20 5:02am    
It is a simple matter to save the new data to a file or database after you add it to the DataGridView. What exactly is the difficulty you are facing?

1 solution

2 Questions in here if I understand it correctly -
1) Read and write to a file using vb.net -
How to read from and write to a text file


2)Add data to a database table using vb.net -
Insert new records into a database


Not sure if the Move row data from this grid to another was a question -
move selected data to another datagridview vb.net
 
Share this answer
 
Comments
Shaheer Rizwan 9-Jul-20 6:19am    
Thank you, I will have a look! Sorry I am abit of a newbie when it comes to programming in general.
Andre Oosthuizen 9-Jul-20 6:22am    
Pleasure and no problem at all, why I gave you 3 tutorial links to follow which will help you sharpen your teeth.

If it helps, you know what to do, thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900