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 8286469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:46:52+00:00 2026-06-08T11:46:52+00:00

I recently started learning C# and im stuck with a gridview and database .

  • 0

I recently started learning C# and im stuck with a gridview and database.

I have a textbox and a button which will add the text in the textbox to my gridview.
but its not working as I want it to.

Problems:

the text from my textbox is not shown. when i click the button the 2nd time i get the following error “Cannot add an entity that allready exsists”.

if I click the array my self a new line is generated but it only shows numbers like, ” -1, -2, -3″ for each array..
if i try to change the numbers to text, the program fails big time.

This is what I have used;
gridview -linked it with my database
LINQ to SQL Classes
Service-based Database

this is my codes. trying to keep it simple as possible.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace database_test2
{
    public partial class Form1 : Form
    {
        Database1DataSet db = new Database1DataSet();
        DataClasses1DataContext dblink = new DataClasses1DataContext();
        Table1 tabel = new Table1();


        public Form1()
        {

            InitializeComponent();

        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            tabel.Materiale = Convert.ToString(textBox1.Text);
            dblink.Table1s.InsertOnSubmit(tabel);
            dblink.SubmitChanges();


        }

        private void database1DataSetBindingSource_CurrentChanged(object sender, EventArgs e)
        {

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'database1DataSet.Table1' table. You can move, or remove it, as needed.
            this.table1TableAdapter.Fill(this.database1DataSet.Table1);

        }
    }
}
  • 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-06-08T11:46:54+00:00Added an answer on June 8, 2026 at 11:46 am

    The most common issue when startin asp.net webforms is forgetting calling DataBind() method, after some changes, editing etc. This method inits data to view control in order to render it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently started learning C++, but I require a compiler. I have tried
I just recently have started learning about the wonders of **kwargs but I've hit
I have recently started learning c# and have come across an issue. I'm not
Recently I have started learning rails and was a little surprised that the default
I have only started learning python recently. I would still be considered a beginner.
I've recently started learning OpenGl through the SB fifth edition, unfortunately got stuck right
I have recently started learning about Software as a Service and Cloud computing. Often
I have recently started learning Ruby, as my first programming language. I feel comfortable
Ok, so I recently started learning jQuery, but I'm having trouble with a little
I've recently started learning scala, and I've come across the :: (cons) function, which

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.