Click here to Skip to main content
15,911,327 members
Home / Discussions / C#
   

C#

 
GeneralRe: Copying UserControl Variables to another instance of the UserControl Pin
TheBlindWatchmaker6-Jul-06 8:13
TheBlindWatchmaker6-Jul-06 8:13 
GeneralRe: Copying UserControl Variables to another instance of the UserControl Pin
Dustin Metzgar6-Jul-06 8:28
Dustin Metzgar6-Jul-06 8:28 
QuestionTransferring data from database to database Pin
Stephen Hurt6-Jul-06 6:27
Stephen Hurt6-Jul-06 6:27 
AnswerRe: Transferring data from database to database Pin
led mike6-Jul-06 6:40
led mike6-Jul-06 6:40 
AnswerRe: Transferring data from database to database Pin
BambooMoon6-Jul-06 7:09
BambooMoon6-Jul-06 7:09 
Questionif/else statement for command button; object reference not set to an instance error Pin
leckey6-Jul-06 6:15
leckey6-Jul-06 6:15 
AnswerRe: if/else statement for command button; object reference not set to an instance error Pin
Guffa6-Jul-06 6:21
Guffa6-Jul-06 6:21 
GeneralRe: if/else statement for command button; object reference not set to an instance error Pin
leckey6-Jul-06 7:08
leckey6-Jul-06 7:08 
I have a new goofy error. When I hit button 2 (the if/else button I'm referring to) the code does not hit it. When I change the code back to what I had (which was not an if/else) it hits the code

Old code:
private void Button2_Click(object sender, System.EventArgs e)<br />
		{	<br />
			BindData();<br />
			DataTable dt = ds.Tables["Rest"];<br />
			DataRow row;<br />
			row = dt.NewRow();	<br />
			strPartNumberInputReference = txtSearchPart.Text;<br />
			row["PartNumber"] = strPartNumberInputReference; <br />
			row["DrawingNumber"]=DBNull.Value;<br />
			row["DrawingRevision"]=DBNull.Value;<br />
			row["DwgPath"]=DBNull.Value;<br />
			dt.Rows.Add(row);			<br />
			dt.AcceptChanges();			  <br />
			dgParts.DataSource=dt;			<br />
			dgParts.DataBind();


New code that it doesn't call:
DataGridItemCollection items = dgParts.Items;<br />
		<br />
			int rows = items.Count;<br />
			if (rows == 0)<br />
			{<br />
				BindData();<br />
				DataTable dt = ds.Tables["Rest"];<br />
				DataRow row;<br />
				row = dt.NewRow();	<br />
				strPartNumberInputReference = txtSearchPart.Text;<br />
				row["PartNumber"] = strPartNumberInputReference; <br />
				row["DrawingNumber"]=DBNull.Value;<br />
				row["DrawingRevision"]=DBNull.Value;<br />
				row["DwgPath"]=DBNull.Value;<br />
				<br />
				dt.Rows.Add(row);			<br />
				dt.AcceptChanges();			  <br />
				dgParts.DataSource=dt;			<br />
				dgParts.DataBind();<br />
			}<br />
<br />
			else<br />
			{<br />
				DataTable dt = ds.Tables["Rest"];<br />
				ds = (DataSet) Session["ds"];<br />
				DataRow row;<br />
				row = dt.NewRow();	<br />
				strPartNumberInputReference = txtSearchPart.Text;<br />
				row["PartNumber"] = strPartNumberInputReference; <br />
				row["DrawingNumber"]=DBNull.Value;<br />
				row["DrawingRevision"]=DBNull.Value;<br />
				row["DwgPath"]=DBNull.Value;<br />
				dt.Rows.Add(row);			<br />
				dt.AcceptChanges();			  <br />
				dgParts.DataSource=dt;			<br />
				dgParts.DataBind();<br />
			}


Previously I got the program to at least call the if/else when I was messing around with the code.

I do not have BindData in my Page_Load function because I want to call it when I actually need it. Does this have something to do with it?
GeneralRe: if/else statement for command button; object reference not set to an instance error Pin
Paul Conrad6-Jul-06 7:17
professionalPaul Conrad6-Jul-06 7:17 
GeneralRe: if/else statement for command button; object reference not set to an instance error [modified] Pin
leckey6-Jul-06 7:55
leckey6-Jul-06 7:55 
GeneralRe: if/else statement for command button; object reference not set to an instance error Pin
Paul Conrad6-Jul-06 8:00
professionalPaul Conrad6-Jul-06 8:00 
GeneralRe: if/else statement for command button; object reference not set to an instance error Pin
Paul Conrad6-Jul-06 8:04
professionalPaul Conrad6-Jul-06 8:04 
AnswerRe: if/else statement for command button; object reference not set to an instance error Pin
Guffa6-Jul-06 8:16
Guffa6-Jul-06 8:16 
GeneralRe: if/else statement for command button; object reference not set to an instance error Pin
leckey6-Jul-06 8:40
leckey6-Jul-06 8:40 
AnswerRe: if/else statement for command button; object reference not set to an instance error Pin
Paul Conrad6-Jul-06 6:59
professionalPaul Conrad6-Jul-06 6:59 
QuestionListView Item/Subitem backcolor solution Pin
Aaron Dilliard6-Jul-06 5:33
Aaron Dilliard6-Jul-06 5:33 
QuestionPlugin can't see referenced code Pin
berry seltzer6-Jul-06 5:17
berry seltzer6-Jul-06 5:17 
QuestionHow to retrieve image with Html Pin
Bluebamboo6-Jul-06 5:13
Bluebamboo6-Jul-06 5:13 
AnswerRe: How to retrieve image with Html Pin
Not Active6-Jul-06 5:32
mentorNot Active6-Jul-06 5:32 
GeneralRe: How to retrieve image with Html Pin
Bluebamboo6-Jul-06 5:46
Bluebamboo6-Jul-06 5:46 
AnswerRe: How to retrieve image with Html Pin
led mike6-Jul-06 5:42
led mike6-Jul-06 5:42 
GeneralRe: How to retrieve image with Html Pin
Bluebamboo6-Jul-06 5:58
Bluebamboo6-Jul-06 5:58 
GeneralRe: How to retrieve image with Html Pin
led mike6-Jul-06 6:26
led mike6-Jul-06 6:26 
GeneralRe: How to retrieve image with Html Pin
Bluebamboo6-Jul-06 6:31
Bluebamboo6-Jul-06 6:31 
Questiontiff file reading Pin
roopeshgangwar6-Jul-06 4:16
roopeshgangwar6-Jul-06 4:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.