C# NullReference, What do I Need to Initialize? [duplicate]What is a NullReferenceException, and how do I fix it?How do I calculate someone's age in C#?What is the difference between String and string in C#?What does the [Flags] Enum Attribute mean in C#?Hidden Features of C#?Cast int to enum in C#How do I enumerate an enum in C#?What is the best way to iterate over a dictionary?What are the correct version numbers for C#?What do two question marks together mean in C#?Exception is System.Data.SqlClient.SqlException: Incorrect syntax near '9988'

Is it necessary to use pronouns with the verb "essere"?

How to explain what's wrong with this application of the chain rule?

Doesn't the system of the Supreme Court oppose justice?

The Digit Triangles

How many arrows is an archer expected to fire by the end of the Tyranny of Dragons pair of adventures?

Is this part of the description of the Archfey warlock's Misty Escape feature redundant?

How could a planet have erratic days?

How to draw a matrix with arrows in limited space

Can I say "fingers" when referring to toes?

How to convince somebody that he is fit for something else, but not this job?

It grows, but water kills it

A Trivial Diagnosis

Can I cause damage to electrical appliances by unplugging them when they are turned on?

How can ping know if my host is down

Are Captain Marvel's powers affected by Thanos breaking the Tesseract and claiming the stone?

What is the English pronunciation of "pain au chocolat"?

How much of a Devil Fruit must be consumed to gain the power?

C++ check if statement can be evaluated constexpr

What are some good ways to treat frozen vegetables such that they behave like fresh vegetables when stir frying them?

Why is the Sun approximated as a black body at ~ 5800 K?

Is there a RAID 0 Equivalent for RAM?

Mimic lecturing on blackboard, facing audience

Why should universal income be universal?

How do I fix the group tension caused by my character stealing and possibly killing without provocation?



C# NullReference, What do I Need to Initialize? [duplicate]


What is a NullReferenceException, and how do I fix it?How do I calculate someone's age in C#?What is the difference between String and string in C#?What does the [Flags] Enum Attribute mean in C#?Hidden Features of C#?Cast int to enum in C#How do I enumerate an enum in C#?What is the best way to iterate over a dictionary?What are the correct version numbers for C#?What do two question marks together mean in C#?Exception is System.Data.SqlClient.SqlException: Incorrect syntax near '9988'













0
















This question already has an answer here:



  • What is a NullReferenceException, and how do I fix it?

    31 answers



Newbie question: What exactly needs to be initialized to prevent a NullReferenceException? I don't understand what the variable is. What object reference do I need to set to an instance of what object? Thank you!



.aspx



 <p>
<asp:GridView ID="gvConvo" runat="server" AutoGenerateColumns="False" OnSelectedIndexChanged="gvConvo_SelectedIndexChanged">
<Columns>
<asp:TemplateField HeaderText="ID">
<ItemTemplate>
<asp:LinkButton ID="lbtnConvo" OnClick="lbtnConvo_Click" Text='<%#Eval("ConvoUID") %>' runat="server">LinkButton</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Convo" HeaderText="Convo" />
<asp:BoundField DataField="ConvoDate" HeaderText="Date" />
<asp:BoundField DataField="ConvoDesc" HeaderText="Description" />
<asp:BoundField DataField="ConvoType" HeaderText="Type" />
<asp:BoundField DataField="MediaSource" HeaderText="Media Source" />
</Columns>
</asp:GridView>
</p>
<p>
&nbsp;</p>
<p>
Convo:
<asp:TextBox ID="txtConvoSelection" runat="server" OnTextChanged="txtConvoSelection_TextChanged"></asp:TextBox>
</p>


.cs



 protected void Page_Load(object sender, EventArgs e)

if (!IsPostBack)

string PersuasionDBCon = ConfigurationManager.ConnectionStrings["PersuasionDBCon"].ConnectionString;
using (SqlConnection con = new SqlConnection(PersuasionDBCon))

SqlCommand cmd = new SqlCommand("GetConvo", con);
cmd.CommandType = CommandType.StoredProcedure;
con.Open();
gvConvo.DataSource = cmd.ExecuteReader();
gvConvo.DataBind();




protected void lbtnConvo_Click(object sender, EventArgs e)

txtConvoSelection.Text = gvConvo.SelectedRow.Cells[1].Text;


protected void BtnSaveQuote_Click(object sender, EventArgs e)




protected void gvConvo_SelectedIndexChanged(object sender, EventArgs e)




protected void txtConvoSelection_TextChanged(object sender, EventArgs e)





This is the line that's throwing the exception:



txtConvoSelection.Text = gvConvo.SelectedRow.Cells[1].Text;









share|improve this question













marked as duplicate by Uwe Keim c#
Users with the  c# badge can single-handedly close c# questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 7 at 5:31


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.













  • 1





    Either txtConvoSelection is null, gvConvo is null, SelectedRow is null, or (less likely, frankly) Cells[1] is null.

    – John
    Mar 7 at 5:13











  • txtConvoSelection is just an empty text box that's waiting to be populated on lbtnConvo_Click. Is that the same as being null? If the value isn't null to start with, what should it be?

    – Vesper Annstas
    Mar 7 at 5:18
















0
















This question already has an answer here:



  • What is a NullReferenceException, and how do I fix it?

    31 answers



Newbie question: What exactly needs to be initialized to prevent a NullReferenceException? I don't understand what the variable is. What object reference do I need to set to an instance of what object? Thank you!



.aspx



 <p>
<asp:GridView ID="gvConvo" runat="server" AutoGenerateColumns="False" OnSelectedIndexChanged="gvConvo_SelectedIndexChanged">
<Columns>
<asp:TemplateField HeaderText="ID">
<ItemTemplate>
<asp:LinkButton ID="lbtnConvo" OnClick="lbtnConvo_Click" Text='<%#Eval("ConvoUID") %>' runat="server">LinkButton</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Convo" HeaderText="Convo" />
<asp:BoundField DataField="ConvoDate" HeaderText="Date" />
<asp:BoundField DataField="ConvoDesc" HeaderText="Description" />
<asp:BoundField DataField="ConvoType" HeaderText="Type" />
<asp:BoundField DataField="MediaSource" HeaderText="Media Source" />
</Columns>
</asp:GridView>
</p>
<p>
&nbsp;</p>
<p>
Convo:
<asp:TextBox ID="txtConvoSelection" runat="server" OnTextChanged="txtConvoSelection_TextChanged"></asp:TextBox>
</p>


.cs



 protected void Page_Load(object sender, EventArgs e)

if (!IsPostBack)

string PersuasionDBCon = ConfigurationManager.ConnectionStrings["PersuasionDBCon"].ConnectionString;
using (SqlConnection con = new SqlConnection(PersuasionDBCon))

SqlCommand cmd = new SqlCommand("GetConvo", con);
cmd.CommandType = CommandType.StoredProcedure;
con.Open();
gvConvo.DataSource = cmd.ExecuteReader();
gvConvo.DataBind();




protected void lbtnConvo_Click(object sender, EventArgs e)

txtConvoSelection.Text = gvConvo.SelectedRow.Cells[1].Text;


protected void BtnSaveQuote_Click(object sender, EventArgs e)




protected void gvConvo_SelectedIndexChanged(object sender, EventArgs e)




protected void txtConvoSelection_TextChanged(object sender, EventArgs e)





This is the line that's throwing the exception:



txtConvoSelection.Text = gvConvo.SelectedRow.Cells[1].Text;









share|improve this question













marked as duplicate by Uwe Keim c#
Users with the  c# badge can single-handedly close c# questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 7 at 5:31


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.













  • 1





    Either txtConvoSelection is null, gvConvo is null, SelectedRow is null, or (less likely, frankly) Cells[1] is null.

    – John
    Mar 7 at 5:13











  • txtConvoSelection is just an empty text box that's waiting to be populated on lbtnConvo_Click. Is that the same as being null? If the value isn't null to start with, what should it be?

    – Vesper Annstas
    Mar 7 at 5:18














0












0








0









This question already has an answer here:



  • What is a NullReferenceException, and how do I fix it?

    31 answers



Newbie question: What exactly needs to be initialized to prevent a NullReferenceException? I don't understand what the variable is. What object reference do I need to set to an instance of what object? Thank you!



.aspx



 <p>
<asp:GridView ID="gvConvo" runat="server" AutoGenerateColumns="False" OnSelectedIndexChanged="gvConvo_SelectedIndexChanged">
<Columns>
<asp:TemplateField HeaderText="ID">
<ItemTemplate>
<asp:LinkButton ID="lbtnConvo" OnClick="lbtnConvo_Click" Text='<%#Eval("ConvoUID") %>' runat="server">LinkButton</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Convo" HeaderText="Convo" />
<asp:BoundField DataField="ConvoDate" HeaderText="Date" />
<asp:BoundField DataField="ConvoDesc" HeaderText="Description" />
<asp:BoundField DataField="ConvoType" HeaderText="Type" />
<asp:BoundField DataField="MediaSource" HeaderText="Media Source" />
</Columns>
</asp:GridView>
</p>
<p>
&nbsp;</p>
<p>
Convo:
<asp:TextBox ID="txtConvoSelection" runat="server" OnTextChanged="txtConvoSelection_TextChanged"></asp:TextBox>
</p>


.cs



 protected void Page_Load(object sender, EventArgs e)

if (!IsPostBack)

string PersuasionDBCon = ConfigurationManager.ConnectionStrings["PersuasionDBCon"].ConnectionString;
using (SqlConnection con = new SqlConnection(PersuasionDBCon))

SqlCommand cmd = new SqlCommand("GetConvo", con);
cmd.CommandType = CommandType.StoredProcedure;
con.Open();
gvConvo.DataSource = cmd.ExecuteReader();
gvConvo.DataBind();




protected void lbtnConvo_Click(object sender, EventArgs e)

txtConvoSelection.Text = gvConvo.SelectedRow.Cells[1].Text;


protected void BtnSaveQuote_Click(object sender, EventArgs e)




protected void gvConvo_SelectedIndexChanged(object sender, EventArgs e)




protected void txtConvoSelection_TextChanged(object sender, EventArgs e)





This is the line that's throwing the exception:



txtConvoSelection.Text = gvConvo.SelectedRow.Cells[1].Text;









share|improve this question















This question already has an answer here:



  • What is a NullReferenceException, and how do I fix it?

    31 answers



Newbie question: What exactly needs to be initialized to prevent a NullReferenceException? I don't understand what the variable is. What object reference do I need to set to an instance of what object? Thank you!



.aspx



 <p>
<asp:GridView ID="gvConvo" runat="server" AutoGenerateColumns="False" OnSelectedIndexChanged="gvConvo_SelectedIndexChanged">
<Columns>
<asp:TemplateField HeaderText="ID">
<ItemTemplate>
<asp:LinkButton ID="lbtnConvo" OnClick="lbtnConvo_Click" Text='<%#Eval("ConvoUID") %>' runat="server">LinkButton</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Convo" HeaderText="Convo" />
<asp:BoundField DataField="ConvoDate" HeaderText="Date" />
<asp:BoundField DataField="ConvoDesc" HeaderText="Description" />
<asp:BoundField DataField="ConvoType" HeaderText="Type" />
<asp:BoundField DataField="MediaSource" HeaderText="Media Source" />
</Columns>
</asp:GridView>
</p>
<p>
&nbsp;</p>
<p>
Convo:
<asp:TextBox ID="txtConvoSelection" runat="server" OnTextChanged="txtConvoSelection_TextChanged"></asp:TextBox>
</p>


.cs



 protected void Page_Load(object sender, EventArgs e)

if (!IsPostBack)

string PersuasionDBCon = ConfigurationManager.ConnectionStrings["PersuasionDBCon"].ConnectionString;
using (SqlConnection con = new SqlConnection(PersuasionDBCon))

SqlCommand cmd = new SqlCommand("GetConvo", con);
cmd.CommandType = CommandType.StoredProcedure;
con.Open();
gvConvo.DataSource = cmd.ExecuteReader();
gvConvo.DataBind();




protected void lbtnConvo_Click(object sender, EventArgs e)

txtConvoSelection.Text = gvConvo.SelectedRow.Cells[1].Text;


protected void BtnSaveQuote_Click(object sender, EventArgs e)




protected void gvConvo_SelectedIndexChanged(object sender, EventArgs e)




protected void txtConvoSelection_TextChanged(object sender, EventArgs e)





This is the line that's throwing the exception:



txtConvoSelection.Text = gvConvo.SelectedRow.Cells[1].Text;




This question already has an answer here:



  • What is a NullReferenceException, and how do I fix it?

    31 answers







c# asp.net






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 7 at 5:10









Vesper AnnstasVesper Annstas

649




649




marked as duplicate by Uwe Keim c#
Users with the  c# badge can single-handedly close c# questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 7 at 5:31


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Uwe Keim c#
Users with the  c# badge can single-handedly close c# questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 7 at 5:31


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









  • 1





    Either txtConvoSelection is null, gvConvo is null, SelectedRow is null, or (less likely, frankly) Cells[1] is null.

    – John
    Mar 7 at 5:13











  • txtConvoSelection is just an empty text box that's waiting to be populated on lbtnConvo_Click. Is that the same as being null? If the value isn't null to start with, what should it be?

    – Vesper Annstas
    Mar 7 at 5:18













  • 1





    Either txtConvoSelection is null, gvConvo is null, SelectedRow is null, or (less likely, frankly) Cells[1] is null.

    – John
    Mar 7 at 5:13











  • txtConvoSelection is just an empty text box that's waiting to be populated on lbtnConvo_Click. Is that the same as being null? If the value isn't null to start with, what should it be?

    – Vesper Annstas
    Mar 7 at 5:18








1




1





Either txtConvoSelection is null, gvConvo is null, SelectedRow is null, or (less likely, frankly) Cells[1] is null.

– John
Mar 7 at 5:13





Either txtConvoSelection is null, gvConvo is null, SelectedRow is null, or (less likely, frankly) Cells[1] is null.

– John
Mar 7 at 5:13













txtConvoSelection is just an empty text box that's waiting to be populated on lbtnConvo_Click. Is that the same as being null? If the value isn't null to start with, what should it be?

– Vesper Annstas
Mar 7 at 5:18






txtConvoSelection is just an empty text box that's waiting to be populated on lbtnConvo_Click. Is that the same as being null? If the value isn't null to start with, what should it be?

– Vesper Annstas
Mar 7 at 5:18













2 Answers
2






active

oldest

votes


















2














The code to load the grid is surrounded by an if (!IsPostBack) block. Guess what? The button click event causes a postback. That's how it runs. And every time you do a postback, the entire page starts over from scratch. That's how HTTP works.



So when you click the button, the data for the grid is not bound, and there is no selected row.



The best fix for this is to make this happen in javascript, rather than C#. Reserve server events for things that really need to do work on the server. That will greatly improve perceived performance (no waiting for round-trips to a potentially-distant server) and help your server scale to handle more users by not needing to rebuild the entire html document for simple changes.






share|improve this answer

























  • Thanks, Joel! I commented out the <!-- language: c# -->if (!IsPostBack) lines so that the data would be bound when I click the button, but am still getting the same error.

    – Vesper Annstas
    Mar 7 at 5:26












  • @VesperAnnstas That's an improvement... but ViewState is restored before the page load phase, so if the data isn't loaded earlier (Pre_Init is one option) there still can't be a selected row. I updated the answer to suggest a better fix, though.

    – Joel Coehoorn
    Mar 7 at 5:28






  • 1





    Oh: and use backtick characters (just below the escape key) in comments to mark code sections.

    – Joel Coehoorn
    Mar 7 at 5:30


















0














Index starts from 0
gvConvo.SelectedRow.Cells[1] this field must be null



Try



gvConvo.SelectedRow.Cells[0]


Also check for gvConvo.SelectedRow
may be there is no selected in Grid






share|improve this answer























  • Thank you! [1] isn't null, but I did try setting it to [0] just in case. I still get the same error.

    – Vesper Annstas
    Mar 7 at 5:20











  • Then gvConvo.SelectedRow must be NULL

    – Ashish Sapkale
    Mar 7 at 5:45

















2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














The code to load the grid is surrounded by an if (!IsPostBack) block. Guess what? The button click event causes a postback. That's how it runs. And every time you do a postback, the entire page starts over from scratch. That's how HTTP works.



So when you click the button, the data for the grid is not bound, and there is no selected row.



The best fix for this is to make this happen in javascript, rather than C#. Reserve server events for things that really need to do work on the server. That will greatly improve perceived performance (no waiting for round-trips to a potentially-distant server) and help your server scale to handle more users by not needing to rebuild the entire html document for simple changes.






share|improve this answer

























  • Thanks, Joel! I commented out the <!-- language: c# -->if (!IsPostBack) lines so that the data would be bound when I click the button, but am still getting the same error.

    – Vesper Annstas
    Mar 7 at 5:26












  • @VesperAnnstas That's an improvement... but ViewState is restored before the page load phase, so if the data isn't loaded earlier (Pre_Init is one option) there still can't be a selected row. I updated the answer to suggest a better fix, though.

    – Joel Coehoorn
    Mar 7 at 5:28






  • 1





    Oh: and use backtick characters (just below the escape key) in comments to mark code sections.

    – Joel Coehoorn
    Mar 7 at 5:30















2














The code to load the grid is surrounded by an if (!IsPostBack) block. Guess what? The button click event causes a postback. That's how it runs. And every time you do a postback, the entire page starts over from scratch. That's how HTTP works.



So when you click the button, the data for the grid is not bound, and there is no selected row.



The best fix for this is to make this happen in javascript, rather than C#. Reserve server events for things that really need to do work on the server. That will greatly improve perceived performance (no waiting for round-trips to a potentially-distant server) and help your server scale to handle more users by not needing to rebuild the entire html document for simple changes.






share|improve this answer

























  • Thanks, Joel! I commented out the <!-- language: c# -->if (!IsPostBack) lines so that the data would be bound when I click the button, but am still getting the same error.

    – Vesper Annstas
    Mar 7 at 5:26












  • @VesperAnnstas That's an improvement... but ViewState is restored before the page load phase, so if the data isn't loaded earlier (Pre_Init is one option) there still can't be a selected row. I updated the answer to suggest a better fix, though.

    – Joel Coehoorn
    Mar 7 at 5:28






  • 1





    Oh: and use backtick characters (just below the escape key) in comments to mark code sections.

    – Joel Coehoorn
    Mar 7 at 5:30













2












2








2







The code to load the grid is surrounded by an if (!IsPostBack) block. Guess what? The button click event causes a postback. That's how it runs. And every time you do a postback, the entire page starts over from scratch. That's how HTTP works.



So when you click the button, the data for the grid is not bound, and there is no selected row.



The best fix for this is to make this happen in javascript, rather than C#. Reserve server events for things that really need to do work on the server. That will greatly improve perceived performance (no waiting for round-trips to a potentially-distant server) and help your server scale to handle more users by not needing to rebuild the entire html document for simple changes.






share|improve this answer















The code to load the grid is surrounded by an if (!IsPostBack) block. Guess what? The button click event causes a postback. That's how it runs. And every time you do a postback, the entire page starts over from scratch. That's how HTTP works.



So when you click the button, the data for the grid is not bound, and there is no selected row.



The best fix for this is to make this happen in javascript, rather than C#. Reserve server events for things that really need to do work on the server. That will greatly improve perceived performance (no waiting for round-trips to a potentially-distant server) and help your server scale to handle more users by not needing to rebuild the entire html document for simple changes.







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 7 at 5:29

























answered Mar 7 at 5:20









Joel CoehoornJoel Coehoorn

311k96497732




311k96497732












  • Thanks, Joel! I commented out the <!-- language: c# -->if (!IsPostBack) lines so that the data would be bound when I click the button, but am still getting the same error.

    – Vesper Annstas
    Mar 7 at 5:26












  • @VesperAnnstas That's an improvement... but ViewState is restored before the page load phase, so if the data isn't loaded earlier (Pre_Init is one option) there still can't be a selected row. I updated the answer to suggest a better fix, though.

    – Joel Coehoorn
    Mar 7 at 5:28






  • 1





    Oh: and use backtick characters (just below the escape key) in comments to mark code sections.

    – Joel Coehoorn
    Mar 7 at 5:30

















  • Thanks, Joel! I commented out the <!-- language: c# -->if (!IsPostBack) lines so that the data would be bound when I click the button, but am still getting the same error.

    – Vesper Annstas
    Mar 7 at 5:26












  • @VesperAnnstas That's an improvement... but ViewState is restored before the page load phase, so if the data isn't loaded earlier (Pre_Init is one option) there still can't be a selected row. I updated the answer to suggest a better fix, though.

    – Joel Coehoorn
    Mar 7 at 5:28






  • 1





    Oh: and use backtick characters (just below the escape key) in comments to mark code sections.

    – Joel Coehoorn
    Mar 7 at 5:30
















Thanks, Joel! I commented out the <!-- language: c# -->if (!IsPostBack) lines so that the data would be bound when I click the button, but am still getting the same error.

– Vesper Annstas
Mar 7 at 5:26






Thanks, Joel! I commented out the <!-- language: c# -->if (!IsPostBack) lines so that the data would be bound when I click the button, but am still getting the same error.

– Vesper Annstas
Mar 7 at 5:26














@VesperAnnstas That's an improvement... but ViewState is restored before the page load phase, so if the data isn't loaded earlier (Pre_Init is one option) there still can't be a selected row. I updated the answer to suggest a better fix, though.

– Joel Coehoorn
Mar 7 at 5:28





@VesperAnnstas That's an improvement... but ViewState is restored before the page load phase, so if the data isn't loaded earlier (Pre_Init is one option) there still can't be a selected row. I updated the answer to suggest a better fix, though.

– Joel Coehoorn
Mar 7 at 5:28




1




1





Oh: and use backtick characters (just below the escape key) in comments to mark code sections.

– Joel Coehoorn
Mar 7 at 5:30





Oh: and use backtick characters (just below the escape key) in comments to mark code sections.

– Joel Coehoorn
Mar 7 at 5:30













0














Index starts from 0
gvConvo.SelectedRow.Cells[1] this field must be null



Try



gvConvo.SelectedRow.Cells[0]


Also check for gvConvo.SelectedRow
may be there is no selected in Grid






share|improve this answer























  • Thank you! [1] isn't null, but I did try setting it to [0] just in case. I still get the same error.

    – Vesper Annstas
    Mar 7 at 5:20











  • Then gvConvo.SelectedRow must be NULL

    – Ashish Sapkale
    Mar 7 at 5:45















0














Index starts from 0
gvConvo.SelectedRow.Cells[1] this field must be null



Try



gvConvo.SelectedRow.Cells[0]


Also check for gvConvo.SelectedRow
may be there is no selected in Grid






share|improve this answer























  • Thank you! [1] isn't null, but I did try setting it to [0] just in case. I still get the same error.

    – Vesper Annstas
    Mar 7 at 5:20











  • Then gvConvo.SelectedRow must be NULL

    – Ashish Sapkale
    Mar 7 at 5:45













0












0








0







Index starts from 0
gvConvo.SelectedRow.Cells[1] this field must be null



Try



gvConvo.SelectedRow.Cells[0]


Also check for gvConvo.SelectedRow
may be there is no selected in Grid






share|improve this answer













Index starts from 0
gvConvo.SelectedRow.Cells[1] this field must be null



Try



gvConvo.SelectedRow.Cells[0]


Also check for gvConvo.SelectedRow
may be there is no selected in Grid







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 7 at 5:13









Ashish SapkaleAshish Sapkale

455213




455213












  • Thank you! [1] isn't null, but I did try setting it to [0] just in case. I still get the same error.

    – Vesper Annstas
    Mar 7 at 5:20











  • Then gvConvo.SelectedRow must be NULL

    – Ashish Sapkale
    Mar 7 at 5:45

















  • Thank you! [1] isn't null, but I did try setting it to [0] just in case. I still get the same error.

    – Vesper Annstas
    Mar 7 at 5:20











  • Then gvConvo.SelectedRow must be NULL

    – Ashish Sapkale
    Mar 7 at 5:45
















Thank you! [1] isn't null, but I did try setting it to [0] just in case. I still get the same error.

– Vesper Annstas
Mar 7 at 5:20





Thank you! [1] isn't null, but I did try setting it to [0] just in case. I still get the same error.

– Vesper Annstas
Mar 7 at 5:20













Then gvConvo.SelectedRow must be NULL

– Ashish Sapkale
Mar 7 at 5:45





Then gvConvo.SelectedRow must be NULL

– Ashish Sapkale
Mar 7 at 5:45



Popular posts from this blog

1928 у кіно

Захаров Федір Захарович

Ель Греко