Click here to Skip to main content
15,886,806 members
Home / Discussions / C#
   

C#

 
AnswerRe: Barcode scanner with MVC C# web Application. Pin
OriginalGriff25-Feb-18 20:06
mveOriginalGriff25-Feb-18 20:06 
Questionhow to loop through textboxes? Pin
Member 1307073625-Feb-18 7:03
Member 1307073625-Feb-18 7:03 
AnswerRe: how to loop through textboxes? Pin
Maciej Los25-Feb-18 7:27
mveMaciej Los25-Feb-18 7:27 
AnswerRe: how to loop through textboxes? Pin
BillWoodruff25-Feb-18 8:46
professionalBillWoodruff25-Feb-18 8:46 
AnswerRe: how to loop through textboxes? Pin
Luc Pattyn25-Feb-18 12:33
sitebuilderLuc Pattyn25-Feb-18 12:33 
GeneralRe: how to loop through textboxes? Pin
OriginalGriff25-Feb-18 21:47
mveOriginalGriff25-Feb-18 21:47 
GeneralRe: how to loop through textboxes? Pin
Member 1307073625-Feb-18 22:06
Member 1307073625-Feb-18 22:06 
GeneralRe: how to loop through textboxes? Pin
OriginalGriff25-Feb-18 22:20
mveOriginalGriff25-Feb-18 22:20 
It's not about effort now - it's about effort later.
Using Visual Studio default names for everything is a very poor idea - you may remember that "TextBox8" is the mobile number today, but when you have to modify it in three weeks time, will you then? Use descriptive names - "tbMobileNo" 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 "tbMobile" in three keystrokes, where "TextBox8" takes thinking about and 8 keystrokes...

And having all names be very, very similar is a recipe for unreliable software as well - it's far, far to easy to get it wrong and not notice. Until of course you have mucked up the DB so badly it's going to take days or weeks of human effort to sort it all out.

And as regards the number of controls, that's good advice as well - it reduces the "clutter" and makes your code more "generic" - it's not fixed to a particular set of textboxes so additions and upgrades become easier - and code changes all the time! Plan for changes and life becomes easier. "Throw it together" without planning and maintenance becomes more difficult and fraught with potential bugs.

Take time to get it right: you won't get time to come back and do it properly later, so just like SQL Injection prone code it will bite you in the ass at a future date when you have forgotten most of how the software works.
It really does save you time and effort in the long run, as well as producing better code.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!

GeneralRe: how to loop through textboxes? Pin
BillWoodruff25-Feb-18 23:18
professionalBillWoodruff25-Feb-18 23:18 
GeneralRe: how to loop through textboxes? Pin
BillWoodruff25-Feb-18 23:02
professionalBillWoodruff25-Feb-18 23:02 
GeneralRe: how to loop through textboxes? Pin
Luc Pattyn26-Feb-18 3:09
sitebuilderLuc Pattyn26-Feb-18 3:09 
GeneralRe: how to loop through textboxes? Pin
OriginalGriff26-Feb-18 4:55
mveOriginalGriff26-Feb-18 4:55 
AnswerRe: how to loop through textboxes? Pin
jsc4227-Feb-18 9:42
professionaljsc4227-Feb-18 9:42 
QuestionC# - showing pdf files from mySQL database without using acrobat reader, how? Pin
Member 1365946625-Feb-18 6:38
Member 1365946625-Feb-18 6:38 
AnswerRe: C# - showing pdf files from mySQL database without using acrobat reader, how? Pin
Dave Kreskowiak25-Feb-18 8:03
mveDave Kreskowiak25-Feb-18 8:03 
AnswerRe: C# - showing pdf files from mySQL database without using acrobat reader, how? Pin
Gerry Schmitz25-Feb-18 14:30
mveGerry Schmitz25-Feb-18 14:30 
AnswerRe: C# - showing pdf files from mySQL database without using acrobat reader, how? Pin
sameer54925-Feb-18 22:14
sameer54925-Feb-18 22:14 
AnswerRe: C# - showing pdf files from mySQL database without using acrobat reader, how? Pin
Eddy Vluggen26-Feb-18 0:10
professionalEddy Vluggen26-Feb-18 0:10 
QuestionMessage Removed Pin
23-Feb-18 9:25
Member 1369343023-Feb-18 9:25 
QuestionMemory leak when converting Bitmap to BitmapImage Pin
Leif Simon Goodwin21-Feb-18 23:55
Leif Simon Goodwin21-Feb-18 23:55 
QuestionC# - How to find total rows affected when using EventLogReader (eventLogQuery)? Pin
Shanmuga Sundaram21-Feb-18 19:56
Shanmuga Sundaram21-Feb-18 19:56 
AnswerRe: C# - How to find total rows affected when using EventLogReader (eventLogQuery)? Pin
Gerry Schmitz22-Feb-18 11:53
mveGerry Schmitz22-Feb-18 11:53 
GeneralRe: C# - How to find total rows affected when using EventLogReader (eventLogQuery)? Pin
Shanmuga Sundaram22-Feb-18 19:22
Shanmuga Sundaram22-Feb-18 19:22 
QuestionIs it ok NOT to pass fields into the methods in the same class as parameters? Pin
User9874320-Feb-18 8:59
professionalUser9874320-Feb-18 8:59 
AnswerRe: Is it ok NOT to pass fields into the methods in the same class as parameters? Pin
Richard MacCutchan20-Feb-18 9:05
mveRichard MacCutchan20-Feb-18 9:05 

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.