0

I am retrieving data from database table.

By giving input as 1 in

textbox1(voucherno)-->damagedetail = web.getdamageddetail(Convert.ToInt32(voucherno.Text)); 

I want get branchno as output in textbox2(branchno)

branchno.Text = damagedetail.branchno.ToString(); 

but am getting error

Object reference is not set into instance of an object.

Check my second line.

Is second line coding correct?

4
  • 1
    objectreference.net/post/… Commented May 15, 2012 at 9:10
  • 1
    Your question is incredibly hard to read. Please put some effort into formatting it and rephrasing it in correct English. Commented May 15, 2012 at 9:11
  • Please use paragraphs and line breaks next time, it was almost impossible to read your question Commented May 15, 2012 at 9:12
  • branchno.text=damagedetail.branchno.tostring();...weather this line retrive branchno from database?? Commented May 15, 2012 at 9:17

2 Answers 2

3

damagedetail.branchno is null.

Try this:

if (damagedetail.branchno != null) branchno.Text = damagedetail.branchno; else branchno.Text = "abcd"; 
Sign up to request clarification or add additional context in comments.

Comments

0

Either your object property is not filled thus when you retrive the value "branchno" from the object the value is equal to null, or your not filling the property in your "getdamageddetail" method

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.