RE: [VB.NET]Email Spammer[SOURCE] 04-03-2013, 11:49 PM
#9
Application.Exit() is what I would have suggested here. If you need an example of And vs. AndAlso I can show you that as well. The reason why I suggested not using MsgBox() is not mainly because it is a VB6 carry over, although that is a valid reason in itself because it may become entirely deprecated in the future and unusable, but rather because of the background code. If you seen the difference between MsgBox() and the Show() function from the MessageBox class you might consider using that instead.
On your updated code however:
Why is the condition for mailpro = 5 in it's own if block? It would also be better to use a case statement here in my opinion as you've got 5 conditions all based on the same variable. In addition to that I don't see a point for mailpro to be a global member variable here. If you wanted to optimize your code I would remove that and just reference the SelectedIndex directly. Whenever you can avoid global member variables though, you should in my opinion, otherwise it's a waste of memory.
Wrote this in notepad quick so there might be errors:
Your progressbar works now though? :huh:
On your updated code however:
Code:
mailpro = ComboBox1.SelectedIndex
If mailpro = 5 Then
GhostTextBox6.ReadOnly = False
GhostTextBox7.ReadOnly = False
Else
GhostTextBox6.ReadOnly = True
GhostTextBox7.ReadOnly = True
End If
If mailpro = 1 Then
GhostTextBox6.Text = "smtp.gmail.com"
GhostTextBox7.Text = "587"
ElseIf mailpro = 2 Then
GhostTextBox6.Text = "smtp.mail.yahoo.com"
GhostTextBox7.Text = "465"
ElseIf mailpro = 3 Then
GhostTextBox6.Text = "smtp.live.com"
GhostTextBox7.Text = "587"
ElseIf mailpro = 4 Then
GhostTextBox6.Text = "smtp.aol.com"
GhostTextBox7.Text = "587"
End IfWhy is the condition for mailpro = 5 in it's own if block? It would also be better to use a case statement here in my opinion as you've got 5 conditions all based on the same variable. In addition to that I don't see a point for mailpro to be a global member variable here. If you wanted to optimize your code I would remove that and just reference the SelectedIndex directly. Whenever you can avoid global member variables though, you should in my opinion, otherwise it's a waste of memory.
Wrote this in notepad quick so there might be errors:
Code:
Select Case ComboBox1.SelectedIndex
Case 5:
GhostTextBox6.ReadOnly = False
GhostTextBox7.ReadOnly = False
Case 1:
GhostTextBox6.Text = "smtp.gmail.com"
GhostTextBox7.Text = "587"
Case 2:
GhostTextBox6.Text = "smtp.mail.yahoo.com"
GhostTextBox7.Text = "465"
Case 3:
GhostTextBox6.Text = "smtp.live.com"
GhostTextBox7.Text = "587"
Case 4:
GhostTextBox6.Text = "smtp.aol.com"
GhostTextBox7.Text = "587"
End Select
GhostTextBox6.ReadOnly = True
GhostTextBox7.ReadOnly = TrueYour progressbar works now though? :huh:
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.ly/images/modern/collapse_collapsed.png)