Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7511677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:37:27+00:00 2026-05-29T23:37:27+00:00

I have a form with a textbox and a add button. The user can

  • 0

I have a form with a textbox and a “add” button.

  1. The user can write a name down on the textbox and click the “add” button. It will save in a datatable with auto ID.
  2. After that, the textbox is cleared and the user can write another name in the text box and click the button.
  3. This should add to the existing datatable in memory with existing ID + 1.
  4. Then show in the gridview. (this is just for display purpose to confirm it works)

I have a datatable like this.

    Button1.click() event

    Dim name = txtname.Text
    Dim dt As New DataTable
    dt.Columns.Add("ID", GetType(Integer))
    dt.Columns.Add("Name", GetType(String))
    Dim N As Integer = dt.Columns("ID").AutoIncrement
    dt.Rows.Add(N, name)
    GridView1.DataSource = dt
    GridView1.DataBind()
    txtname.Text = ""

At the moment I have sometime like the code above. in the real program, it is not just name and it is not just one datatable so i just mock up some code.

and this code for aspx.

        <asp:TextBox ID="txtname" runat="server">
        </asp:TextBox><asp:Button ID="Button1" runat="server" Text="Button" />
        <asp:GridView ID="GridView1" runat="server">
        </asp:GridView>

can anyone advice me how to do it ? i understand my code is crapped and not correct but i just have to put some code so that you guys not need to work from scratch for me.

Thanks so much.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T23:37:29+00:00Added an answer on May 29, 2026 at 11:37 pm

    Here is an example of adding a new row to a datatable that uses AutoIncrement on the first column:

    Define the table structure:

        Dim dt As New DataTable
        dt.Columns.Add("ID")
        dt.Columns.Add("Name")
        dt.Columns(0).AutoIncrement = True
    

    Add a New row:

        Dim R As DataRow = dt.NewRow
        R("Name") = txtName.Text
        dt.Rows.Add(R)
        DataGridView1.DataSource = dt
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to add a textbox inside a form that is composed of a
I have a form with a textbox and a button. IE is the only
I have a web form where I have a textbox in which the user
i have a simple form on my page with a textbox and button that
I have a form in which I have an add button. When the add
I am developing site using codeigniter.I have a form which contains add button and
I have two forms, one with a button 'Add' which loads the second form
I have a simple form (textbox, submit button) which is wrapped in an update
I have a form with one textbox and one button. Here I need to
I have a form with one textbox and one button. Here I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.