Question: I need to store user input (entered from the console) to a Dataset in Visual Basic. Is this possible? I can't seem to find any information online about doing so. If anyone can point me in the right direction, that would be awesome!

EDIT: The columns in my table are FirstName, LastName, State, etc. in a table named Person.
The start of the application for the console: "Enter FirstName: ", then "EnterLastName: " then etc.

The values for the user inputs are stored in there specific variables eg. firstName, lastName, so I want to know how I can put those variables in a dataset. 

Thank you.

Answer: 
Here is a short and basic example. Most likely it will not directly work for what you need as you will probably want to use a typed dataset among other things. Since your question does not specify a question regarding the code you may have already tried, this all I am going to provide.

```
Option Strict On

Module Module1

    Sub Main()    
        Dim ds As DataSet = CreateNewDataSet()
        Dim entries As New List(Of String())
        For i = 1 To 3
            Console.WriteLine($"Enter first column value for row {i.ToString}:")
            Dim input1 As String = Console.ReadLine()
            Console.WriteLine($"Enter second column value for row {i.ToString}:")
            Dim input2 As String = Console.ReadLine()
            entries.Add({input1, input2})
        Next    
        entries.ForEach(Sub(x) ds.Tables(0).Rows.Add(x))    
    End Sub

    Private Function CreateNewDataSet() As DataSet
        Dim ds As New DataSet()
        Dim dt As New DataTable()
        Dim col1 As New DataColumn("Column1")
        Dim col2 As New DataColumn("Column2")
        dt.Columns.AddRange({col1, col2})
        ds.Tables.Add(dt)
        Return ds
    End Function
End Module

```
If you don't know column names, you can use reflection to get names of properties of input objects. You can also use attributes to filter properties. Use `DataTable.LoadDataRow` method to load an array as row.
here is an example to how to do it dynamically:

```
Dim input As New List(Of Object)
For i = 0 To 5  
    Console.WriteLine("enter your first name and last name:")  
    input.Add(New With {.First = Console.ReadLine, .Last = Console.ReadLine})  
Next  

Dim myData As New DataSet  
Dim table = myData.Tables.Add()
table.Columns.AddRange(input.First.GetType.GetProperties.Select(Function(p) New DataColumn(p.Name)).ToArray)
input.ForEach(Function(o) table.LoadDataRow(o.GetType.GetProperties.Select(Function(p) p.GetValue(o, Nothing)).ToArray, False))  

For Each row In table.Rows  
    Console.WriteLine("first:{0} ,Last:{1}", row(0), row(1))  
Next

```