RE: [VB.NET]Email Spammer[SOURCE] 04-04-2013, 06:00 AM
#11
(04-04-2013, 04:30 AM)Psycho_Coder Wrote: Thanks a lot , I didn't knew that part.Okay thanks for your reply.
The updated code , has the functions MessageBox.Show() and Application.Exit(), I had hanged those part, and I will make this sure that in my further application I use Select case.
And for that progress bar , ooh , earlier it was a terrible mistake , but I corrected it and now it works.
Thanks for you nice replies. I learnt something good and from next time I will try to make my code completely perfect.Thank you.
There is simply not much to reply on usually in these forums so it's not that I want to bash your code. Don't take it that way, I would love to help others whenever I can, so that's all I am trying to do here. This just happens to be an active thread in this section, so here I am. I'll jump at any thread here that I see usually.
The rule of thumb I go by, and for good reason, is that definitely anything, 5 conditions or more, should be in a switch or case statement (vb.net) when possible. The reason is because of the way things are dealt with behind the scenes. Case statements can execute faster, as the compiler or CLR can use a lookup/hash table. Anything less than 5 conditions and the case statement is the same as an if statement really... But a Case statement also offers readability which is a good thing. MSIL does have a specific OpCode for case statements, or switch statements in C#.
edit: So this can be converted as well:
Code:
Select Case String.Empty
Case GhostTextBox1.Text
Label12.Visible = True
Case GhostTextBox2.Text
Label13.Visible = True
Case GhostTextBox5.Text
Label14.Visible = True
Case GhostTextBox6.Text, GhostTextBox7.Text
Label15.Visible = True
Label16.Visible = True
MessageBox.Show("Please choose your Mail Provider","Mail Provider Not Chosen",MessageBoxButtons.OK,MessageBoxIcon.Error)
Case Else
clear()
s1 = 0
ProgressBar1.Value = 0
ProgressBar1.Update()
GhostButton1.Enabled = False
GhostButton3.Enabled = False
GhostButton2.Enabled = True
BackgroundWorker1.RunWorkerAsync()
ProgressBar1.Maximum = NumericUpDown1.Value
ProgressBar1.Value = 0
End Select
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

![[+]](https://sinister.li/images/modern/collapse_collapsed.png)
![[Image: OilyCostlyEwe.gif]](http://fat.gfycat.com/OilyCostlyEwe.gif)

moke:
![[Image: 2YpkRjy.png]](http://i.imgur.com/2YpkRjy.png)

