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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:56:11+00:00 2026-05-31T16:56:11+00:00

With this code: private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e) { const int TICKETSOURCE_COLUMN =

  • 0

With this code:

private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            const int TICKETSOURCE_COLUMN = 3;
            const int ABOUTSOMEID_COLUMN = 4;
            const int CATEGORYID_COLUMN = 5;
            const int CONTACTEMAIL_COLUMN = 6;

            textBoxTicketSource.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[TICKETSOURCE_COLUMN].Value);
            textBoxAboutLLSID.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[ABOUTSOMEID_COLUMN].Value);
            textBoxCategoryID.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[CATEGORYID_COLUMN].Value);
            textBoxContactEmail.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[CONTACTEMAIL_COLUMN].Value); 
        }

I’m getting this err msg:

“System.NullReferenceException was unhandled
Message=Object reference not set to an instance of an object.”

I have two questions about this:

1) Why is this a problem/how should I do this instead?

2) Is the RowEnter() event the best place to put this code?

  • 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-31T16:56:12+00:00Added an answer on May 31, 2026 at 4:56 pm

    The const int is not the problem here…

    Either you have mis-numbered them or, more likely, CurrentRow is null

    Post the stacktrace, and simply use the debugger.

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

Sidebar

Related Questions

Got this line of code here but its not working. private void Button_Click(object sender,
This is my code: private void button1_Click(object sender, EventArgs e) { DataTable table =
I have a datagridview with the following code: private void datagridview_CustomerList_CellEndEdit(object sender, DataGridViewCellEventArgs e)
I have this button with the code: private void button22_Click_1(object sender, EventArgs e) {
I have the following code: private void button1_Click(object sender, EventArgs e) { var answer
Hello I'm having a problem here. The code looks like this. private void Form3_Load(object
I have this code private void writeReport(IReport report, string reportName) { string reportString =
this is my code private void sendToClient(Dictionary<string, string> reportDic) { Response.Clear(); Response.BufferOutput = false;
I have this piece of code: private void myFunc(){ obj = doSomething(); //If value
Could you please explain why this code is not syntactically correct? private void addEditor(final

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.