Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27158

BUtton to move multiple text box data to Data grid view

$
0
0
I am new to VB and I am trying to butild a program to make a list then sort it then print both lists.

Excel can do this yes. and I have to MAcros in my excel form but i am trying to rtebuild this in VB for the exe funtionallity without having to pull up Excel.

so I have a DataGridView with 5 columns labeled accordingly
I have 5 test boxes (well 3 and 2 comboboxes.)
and 1 button

The first thing i would like to know is how I can tget the data from all 5 text boxes to the corosponding clumns in the DataGridView.

I did this
Code:

    'Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    'Dim myvariable As String
        myvariable = ComboBox2.Text()
        MsgBox(myvariable)

    'End Sub

Which copies the value of one combo box to a msg box but thats not what i want.

So this DataGridView i have... each time i clik the add info button it needs to create a new line inthe DataGridView Below the existing lines.

Also I have a button that i thought would clear just the inputed date in the DataGrid View, but it is clearing the whole thing including the Headers in the Data Grid View
Code:

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        DataGridView1.DataSource = Nothing
        DataGridView1.Rows.Clear()
        DataGridView1.Columns.Clear()
    End Sub


Viewing all articles
Browse latest Browse all 27158

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>