You might be doing it wrong!
Just a thought. What do you think about a sticky thread where we can assemble typical mistakes people make when start programming in .Net?
For example, literally every day a new person appears here having difficulties with:
then some other man with vb6 background who uses Val(TextBox1.TexT).
Another person starts using default form instances and is happy because it's actually working:
Code:
Form2.TextBox1.Text = "Hello!"
Another man comes with more serious problem showing this:
Code:
Dim sqlquery As String = "SELECT password FROM users WHERE username=" & txtName.Text
Yet another new member is having troubles with the 'Cross thread operation is not valid' when he attempts to access a usercontrol member from another thread, etc
What do you think, will this forum benefit from having such a thread? If so, then what other topics can you suggest to add?
UPDATE
I'll be posting a list of topics to include. The topics so far are:
You're doing it wrong if:
(explanations fill follow later)
... you're using the Int function with a textbox to obtain a numeric value;
... you're using the Val function;
... you're using form's names to refer to their instances (Form1, Form2, etc);
... you're constructing your SQL query right from TextBox values;
... you're directly accessing form's controls from a different thread;
... you're wondering if "2" + "2" results in "22" and not 4;
... you're using the Shell command;
Please, feel free to add/discuss.
Re: You might be doing it wrong!
In theory, it's a great idea. In practice, I doubt that many of the people who could benefit from it would use it. I guess we could all put a link in our signatures and direct people there but the number of people who can't click the CodeBank or Blog links already in my signature is scary. It wouldn't hurt but it wouldn't help nearly as much as it should.
Re: You might be doing it wrong!
I would agree, but I noticed a strange tendency in people when between "Things that you should do!" and "Things you should not do!" they would rather pick the latter topic. :)
Re: You might be doing it wrong!
To a certain extent I agree, however, where do you start with such a thread? It would be a massive amount of information squished into one thread for users to trawl through.
I personally would enjoy such a thread, simply because I'd be able to see where I could improve.
Re: You might be doing it wrong!
I voted "yes", but also have to agree with ohGreen.
Perhaps you can also do this some kind of FAQ, split in several sections. It will be difficult, but got my vote.
Re: You might be doing it wrong!
I also voted yes. But how do you decide what content is worthy? Most of these simple thing's could be answered with a search of vbforums, or the basic task of reading the MSDN documentation regarding said issue. But the people who are to lazy to research them self's are the same people to lazy to read a sticky thread before posting.
I guess even if it helps a handful of people then surely it is worth it?
Re: You might be doing it wrong!
i voted yes too.
you might want to include:
vb Code:
dim a as integer = textbox1.text + textbox2.text
Re: You might be doing it wrong!
I've been righ on the verge of including:
... building a (brand-new) web-browser using a web-browser control, but finally decided against it :D After all it's not a programming mistake.
P.S. I'll be updating the first post from time to time
Re: You might be doing it wrong!
Quote:
Originally Posted by
cicatrix
I've been righ on the verge of including:
... building a (brand-new) web-browser using a web-browser control, but finally decided against it :D After all it's not a programming mistake.
P.S. I'll be updating the first post from time to time
I always quite liked that one. " I am building this new advanced (i could go on all day how advanced it is) web browser "
:(
Re: You might be doing it wrong!
I voted no for the current implementation. I would support a board with threads for each atrocity. That way when you see something that elicits a feeling of fingernails on the chalkboard you can say "Don't use Val. Here's a thread that explains why: <link>"
Re: You might be doing it wrong!
I withheld my vote on the principle that I agree with JMC: It would be a good idea if people would read it, but since they won't, it isn't worth the effort. After all, the list of bad practices would be so huge that anybody who would really benefit from it wouldn't be able to get through the list to find the piece that mattered for them.
Re: You might be doing it wrong!
I agree... it's like the DB questions around here... if they simply looked around, or even did a search, they'd find the DB FAQ & Tutorial thread... and it would solve a number of problems... I think I point people at that thread more often than actually answering the question directly. the only time I really don't are in highly specific cases, or cases where the problem is so convoluted, that the individual problems need to be sorted out first.
-tg
Re: You might be doing it wrong!
This is a good idea (but is it worth the effort), as JMC suggested placing a link into the signature area would be good so that when someone needs to told the proper (or suggested) method you can point them to the link. The link should be the same in any signature so that it is common and in the same position i.e. either the first or last line in the signature rather than buried in the signature. No matter how it is done I also agree with JMC that it is scary that some posters cannot find the link when directed to in a signature line.
Information should be consistent, a short description/summary what is being explained, the reason behind it and a simple/short example of the proper method. Optionally provide at least one wrong way to achieve what appears to be a viable solution to an operation. Optional, if there are known code bank submissions to drive home the point than provide them too.
Some example of how this is handled at MSDN Social forums
Visual Basic .NET General FAQ
Windows Forms Data Controls and Databinding FAQ
Another thought to coincide with this is teaching people how to present their questions. We all know that there are plenty of times where there are countless replies just to understand the poster’s issue because they did not supply enough information.
How To Ask Questions The Smart Way by Eric S Raymond
No matter how much time and effort put into this there will be a percentage of members who will disregard this information especially those who are first timers and want quick solutions and will not care much how it is done. Which brings up another point, current members giving advice that provides a solution that works yet at the same time is bad in that the solution is riddled with issues such as the code assumes a string variable is all numeric and in reality contains alpha characters which are not acceptable thus raising an exception down the road.
Re: You might be doing it wrong!
I would benefit from this even though I have been using the framework since 2007. The transition from vb6 was tough for me. My biggest challenge has
been finding proper examples that 'work'.
I am guilty of using default form instances:
Code:
Form2.TextBox1.Text = "Hello!"
I would include OPTION STRICT ON.
Re: You might be doing it wrong!
TextBox1 = "This is wrong!!!!"
Re: You might be doing it wrong!
Error. Unable to convert string "This is wrong!!!!" to textbox object.
Re: You might be doing it wrong!
Quote:
Originally Posted by
techgnome
Error. Unable to convert string "This is wrong!!!!" to textbox object.
Yep, that was exactly my point