Click here to Skip to main content
15,889,867 members
Home / Discussions / C#
   

C#

 
GeneralRe: SaveFileDialog Pin
BillWoodruff2-Feb-16 2:13
professionalBillWoodruff2-Feb-16 2:13 
GeneralRe: SaveFileDialog Pin
Dave Kreskowiak2-Feb-16 3:51
mveDave Kreskowiak2-Feb-16 3:51 
GeneralRe: SaveFileDialog Pin
John Torjo3-Feb-16 13:39
professionalJohn Torjo3-Feb-16 13:39 
AnswerRe: SaveFileDialog Pin
Kevin Marois3-Feb-16 11:35
professionalKevin Marois3-Feb-16 11:35 
QuestionTextbox help(edited) Pin
Member 122873371-Feb-16 20:25
Member 122873371-Feb-16 20:25 
AnswerRe: Textbox help(edited) Pin
BillWoodruff1-Feb-16 20:55
professionalBillWoodruff1-Feb-16 20:55 
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 
Yes - you have assumed that the user can type, and won't make any mistakes!
If the user types "Hello" or "1.1", then the Convert will fail and throw an exception.
Instead, use TryParse:
C#
int price;
if (!int.TryParse(Texbox1.Text, out price))
   {
   ... Report problem to user and ask him to re-enter
   return;
   }
s.Price = price;
s.Save();


BTW: Do yourself a favour, and stop using Visual Studio default names for everything - you may remember that "Textbox1" is the price today, but when you have to modify it in three weeks time, will you then? Use descriptive names - "tbPrice" for example - and your code becomes easier to read, more self documenting, easier to maintain - and surprisingly quicker to code because Intellisense can get to to "tbPRice" in three keystrokes, where "Textbox1" takes thinking about and 8 keystrokes...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

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 
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 

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.