Click here to Skip to main content
15,881,882 members
Home / Discussions / C#
   

C#

 
GeneralRe: Textbox help(edited) Pin
Member 122873372-Feb-16 8:58
Member 122873372-Feb-16 8:58 
AnswerRe: Textbox help(edited) Pin
OriginalGriff1-Feb-16 20:57
mveOriginalGriff1-Feb-16 20:57 
GeneralRe: Textbox help(edited) Pin
BillWoodruff1-Feb-16 21:06
professionalBillWoodruff1-Feb-16 21:06 
GeneralRe: Textbox help(edited) Pin
OriginalGriff1-Feb-16 21:36
mveOriginalGriff1-Feb-16 21:36 
GeneralRe: Textbox help(edited) Pin
BillWoodruff1-Feb-16 22:32
professionalBillWoodruff1-Feb-16 22:32 
GeneralRe: Textbox help(edited) Pin
Member 122873372-Feb-16 8:54
Member 122873372-Feb-16 8:54 
QuestionTextbox help Pin
Member 122873371-Feb-16 20:25
Member 122873371-Feb-16 20:25 
QuestionTextbox binding/ Pin
Member 122873371-Feb-16 20:24
Member 122873371-Feb-16 20:24 
C#
how are you all.
i am new to asp.net and c#. i need help.

well my question is, i have a textbox in which a user have to enter a float value in the webform.

and i want to manipulate that value in a calculation.
so have created a class for the calculation which is Sales class. in that class i have declared Price as a float value,the value which should be obtained from the textbox.ie public float Price {get;set;}

Now my problem is with binding/linking the Price variable with the textbox in the button_click method.

initially i had done it this way:

in my .aspx.cs file i have created an object of the class in this case :

Sales s = new Sales ();

protected void button_Click (object sender EventArgs e)

{
s.Price =Convert.ToInt32(Textbox1.Text);
s.Save();
}

i want the Price value to be saved in my database after a user clicks the SAVE button from the webform.

Now the problem is when i run the application there is an error (
Hide   Copy Code

An exception of type 'System.NullReferenceException' occurred in Version1.dll but was not handled in user code

)
on the line :
s.Price = Convert.ToInt32(Textbox1.Text);

could i have done something wrong in the code?

Questiondoes MethodInvoker will not work on win XP? Pin
Gilbert Consellado1-Feb-16 18:09
professionalGilbert Consellado1-Feb-16 18:09 
AnswerRe: does MethodInvoker will not work on win XP? Pin
John Torjo1-Feb-16 22:57
professionalJohn Torjo1-Feb-16 22:57 
GeneralRe: does MethodInvoker will not work on win XP? Pin
Gilbert Consellado2-Feb-16 2:17
professionalGilbert Consellado2-Feb-16 2:17 
QuestionRe: does MethodInvoker will not work on win XP? Pin
Alan N1-Feb-16 23:09
Alan N1-Feb-16 23:09 
AnswerRe: does MethodInvoker will not work on win XP? Pin
Gilbert Consellado2-Feb-16 2:19
professionalGilbert Consellado2-Feb-16 2:19 
QuestionRetrieve a date from the result of a query in a variable c # Pin
Ibrahim.elh31-Jan-16 23:07
Ibrahim.elh31-Jan-16 23:07 
AnswerRe: Retrieve a date from the result of a query in a variable c # Pin
Sascha Lefèvre31-Jan-16 23:25
professionalSascha Lefèvre31-Jan-16 23:25 
GeneralRe: Retrieve a date from the result of a query in a variable c # Pin
Ibrahim.elh1-Feb-16 3:05
Ibrahim.elh1-Feb-16 3:05 
GeneralRe: Retrieve a date from the result of a query in a variable c # Pin
Sascha Lefèvre1-Feb-16 3:16
professionalSascha Lefèvre1-Feb-16 3:16 
QuestionReactive Extensions and WeakEvents Pin
Kenneth Haugland30-Jan-16 3:23
mvaKenneth Haugland30-Jan-16 3:23 
AnswerRe: Reactive Extensions and WeakEvents Pin
Sascha Lefèvre30-Jan-16 4:20
professionalSascha Lefèvre30-Jan-16 4:20 
GeneralRe: Reactive Extensions and WeakEvents Pin
Kenneth Haugland30-Jan-16 5:27
mvaKenneth Haugland30-Jan-16 5:27 
GeneralRe: Reactive Extensions and WeakEvents Pin
Sascha Lefèvre30-Jan-16 6:20
professionalSascha Lefèvre30-Jan-16 6:20 
GeneralRe: Reactive Extensions and WeakEvents Pin
Kenneth Haugland30-Jan-16 7:29
mvaKenneth Haugland30-Jan-16 7:29 
GeneralRe: Reactive Extensions and WeakEvents Pin
Sascha Lefèvre30-Jan-16 8:06
professionalSascha Lefèvre30-Jan-16 8:06 
AnswerRe: Reactive Extensions and WeakEvents Pin
Sascha Lefèvre30-Jan-16 11:42
professionalSascha Lefèvre30-Jan-16 11:42 
GeneralRe: Reactive Extensions and WeakEvents Pin
Kenneth Haugland31-Jan-16 1:19
mvaKenneth Haugland31-Jan-16 1:19 

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.