Click here to Skip to main content
15,893,588 members
Home / Discussions / C#
   

C#

 
GeneralRe: SelectedIndex doesn't work with the SelectionChanged event handler but it works with the ButtonClick event handler. Pin
Eddy Vluggen5-Aug-18 10:49
professionalEddy Vluggen5-Aug-18 10:49 
GeneralRe: SelectedIndex doesn't work with the SelectionChanged event handler but it works with the ButtonClick event handler. Pin
Member 138463766-Aug-18 9:18
Member 138463766-Aug-18 9:18 
GeneralRe: SelectedIndex doesn't work with the SelectionChanged event handler but it works with the ButtonClick event handler. Pin
OriginalGriff6-Aug-18 21:50
mveOriginalGriff6-Aug-18 21:50 
GeneralRe: SelectedIndex doesn't work with the SelectionChanged event handler but it works with the ButtonClick event handler. Pin
Member 138463767-Aug-18 3:23
Member 138463767-Aug-18 3:23 
GeneralRe: SelectedIndex doesn't work with the SelectionChanged event handler but it works with the ButtonClick event handler. Pin
Richard Deeming7-Aug-18 3:55
mveRichard Deeming7-Aug-18 3:55 
GeneralRe: SelectedIndex doesn't work with the SelectionChanged event handler but it works with the ButtonClick event handler. Pin
OriginalGriff7-Aug-18 4:10
mveOriginalGriff7-Aug-18 4:10 
SuggestionRe: SelectedIndex doesn't work with the SelectionChanged event handler but it works with the ButtonClick event handler. Pin
Richard Deeming7-Aug-18 4:57
mveRichard Deeming7-Aug-18 4:57 
GeneralRe: SelectedIndex doesn't work with the SelectionChanged event handler but it works with the ButtonClick event handler. Pin
Member 1384637619-Aug-18 3:28
Member 1384637619-Aug-18 3:28 
Thank you all for help, everything worked out, I just had to sit through some toutorials, books and webpages. The program is finished and it's all looking very pretty and realiable.

Now though, I have a very annoying thing about C# to complain about, and I need to ask for some tip on how to handle it properly using some good C# practices...

I have a lot of arithmetic calculations to be solved in the program, and they return wrong values if I don't explicitly specify that a number 2 is a double and not an integer...... For example:

double number =  (double) 6 / (double) 10;
box_d.Text = number.ToString("F3") + " cm"; //returns 0.600 (correct) 
//the funny thing is, the program shows a suggestion that (double) here is an unnecessary cast........

double number =  6 / 10;
box_d.Text = number.ToString("F3") + " cm"; //returns 0.000 (WRONG AS F.)


and on top of that, all future calculations based on this result are also wrong, it's not the fault of the ToString() method. The variable is just wrong!

I mean... I don't mind parsing values like 0.5 as 0.500000019747272 etc. But Having 6/10 display as 0 instead of 0.6 is just so stupid, is there any logical reason for it to be like this? I understand that the program is trying to fit the result into an integer, but I explicitly state that my result must be double... I thought it's supposed to reduce the amount of memory used by the program if I set such simple numbers as integers, but if this kind of errors occur, is it even worth it? What is the good practice to work around this thing?

Should I never define any simple numbers like "2" or "8" as integers but use only "double" for everything?

modified 19-Aug-18 9:58am.

GeneralRe: SelectedIndex doesn't work with the SelectionChanged event handler but it works with the ButtonClick event handler. Pin
Richard Deeming20-Aug-18 7:52
mveRichard Deeming20-Aug-18 7:52 
QuestionWant to change the Validation attribute at runtime ASP.Net MVC Pin
indian1433-Aug-18 7:57
indian1433-Aug-18 7:57 
AnswerRe: Want to change the Validation attribute at runtime ASP.Net MVC Pin
Gerry Schmitz3-Aug-18 9:18
mveGerry Schmitz3-Aug-18 9:18 
GeneralRe: Want to change the Validation attribute at runtime ASP.Net MVC Pin
indian1433-Aug-18 10:17
indian1433-Aug-18 10:17 
AnswerRe: Want to change the Validation attribute at runtime ASP.Net MVC Pin
Richard Deeming3-Aug-18 10:21
mveRichard Deeming3-Aug-18 10:21 
GeneralRe: Want to change the Validation attribute at runtime ASP.Net MVC Pin
indian1433-Aug-18 11:16
indian1433-Aug-18 11:16 
GeneralRe: Want to change the Validation attribute at runtime ASP.Net MVC Pin
Richard Deeming3-Aug-18 12:14
mveRichard Deeming3-Aug-18 12:14 
GeneralRe: Want to change the Validation attribute at runtime ASP.Net MVC Pin
indian1433-Aug-18 12:48
indian1433-Aug-18 12:48 
GeneralRe: Want to change the Validation attribute at runtime ASP.Net MVC Pin
Richard Deeming6-Aug-18 2:05
mveRichard Deeming6-Aug-18 2:05 
GeneralRe: Want to change the Validation attribute at runtime ASP.Net MVC Pin
indian1436-Aug-18 6:39
indian1436-Aug-18 6:39 
GeneralRe: Want to change the Validation attribute at runtime ASP.Net MVC Pin
Richard Deeming6-Aug-18 7:15
mveRichard Deeming6-Aug-18 7:15 
GeneralRe: Want to change the Validation attribute at runtime ASP.Net MVC Pin
indian1436-Aug-18 7:32
indian1436-Aug-18 7:32 
GeneralRe: Want to change the Validation attribute at runtime ASP.Net MVC Pin
Richard Deeming6-Aug-18 9:16
mveRichard Deeming6-Aug-18 9:16 
GeneralRe: Want to change the Validation attribute at runtime ASP.Net MVC Pin
indian1436-Aug-18 10:12
indian1436-Aug-18 10:12 
GeneralRe: Want to change the Validation attribute at runtime ASP.Net MVC Pin
Richard Deeming7-Aug-18 1:56
mveRichard Deeming7-Aug-18 1:56 
QuestionWhen inputting data form main one other always on form main ? Pin
Member 24584672-Aug-18 21:29
Member 24584672-Aug-18 21:29 
AnswerRe: When inputting data form main one other always on form main ? Pin
Richard MacCutchan2-Aug-18 21:40
mveRichard MacCutchan2-Aug-18 21:40 

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.