Hey Group,
Sorry to be a pain again but i have the following code:
If MessageBox.Show("Are Your Sure You Want To Send This Email?", "Are Your
Sure You Want To Send This Email?", MessageBoxButtons.OKCancel) Then
Try
SmtpMail.SmtpServer = txtSMTP.Text
Dim Message As MailMessage
Message = New MailMessage()
Message.From = txtFrom.Text
Message.To = txtTo.Text
Message.Subject = "Excellence.Net - Email"
Message.Body = txtMessage.Text
Message.BodyFormat = MailFormat.Text
SmtpMail.Send(Message)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End If
All is ok - message pops up and asks yes or cancel, however if i click
Cancel it still send the message? anybody kindly point me in the right
direction?
Ta
MCN 7 1406
"MadCrazyNewbie" <te**@nospam.com> schrieb If MessageBox.Show("Are Your Sure You Want To Send This Email?", "Are Your Sure You Want To Send This Email?", MessageBoxButtons.OKCancel) Then Try SmtpMail.SmtpServer = txtSMTP.Text Dim Message As MailMessage Message = New MailMessage() Message.From = txtFrom.Text Message.To = txtTo.Text Message.Subject = "Excellence.Net - Email" Message.Body = txtMessage.Text Message.BodyFormat = MailFormat.Text SmtpMail.Send(Message) Catch ex As Exception MsgBox(ex.ToString) End Try End If
All is ok - message pops up and asks yes or cancel, however if i click Cancel it still send the message? anybody kindly point me in the right direction?
Enable Option Strict.
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
Armin,
I`ve enabled Options Strict On but now I get a message saying:
D:\Live Projects\Excellence.Net\EmailForm.vb(240): Option Strict On
disallows implicit conversions from 'System.Windows.Forms.DialogResult' to
'Boolean'.
on
If MessageBox.Show("Are Your Sure You Want To Send This Email?", "Are Your
Sure You Want To Send This Email?", MessageBoxButtons.OKCancel) Then
Any Ideas?
Cheers
MCN
"Armin Zingler" <az*******@freenet.de> wrote in message
news:40*********************@news.freenet.de... "MadCrazyNewbie" <te**@nospam.com> schrieb If MessageBox.Show("Are Your Sure You Want To Send This Email?", "Are Your Sure You Want To Send This Email?", MessageBoxButtons.OKCancel) Then Try SmtpMail.SmtpServer = txtSMTP.Text Dim Message As MailMessage Message = New MailMessage() Message.From = txtFrom.Text Message.To = txtTo.Text Message.Subject = "Excellence.Net - Email" Message.Body = txtMessage.Text Message.BodyFormat = MailFormat.Text SmtpMail.Send(Message) Catch ex As Exception MsgBox(ex.ToString) End Try End If
All is ok - message pops up and asks yes or cancel, however if i click Cancel it still send the message? anybody kindly point me in the right direction?
Enable Option Strict.
-- Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
How about testing for the messagebox return being equal to the OK button?
--
Al Reid
"It ain't what you don't know that gets you into trouble. It's what you know
for sure that just ain't so." --- Mark Twain
"MadCrazyNewbie" <te**@nospam.com> wrote in message news:ec********************@karoo.co.uk... Armin,
I`ve enabled Options Strict On but now I get a message saying:
D:\Live Projects\Excellence.Net\EmailForm.vb(240): Option Strict On disallows implicit conversions from 'System.Windows.Forms.DialogResult' to 'Boolean'.
on If MessageBox.Show("Are Your Sure You Want To Send This Email?", "Are Your Sure You Want To Send This Email?", MessageBoxButtons.OKCancel) Then
Any Ideas?
Cheers MCN
"Armin Zingler" <az*******@freenet.de> wrote in message news:40*********************@news.freenet.de... "MadCrazyNewbie" <te**@nospam.com> schrieb If MessageBox.Show("Are Your Sure You Want To Send This Email?", "Are Your Sure You Want To Send This Email?", MessageBoxButtons.OKCancel) Then Try SmtpMail.SmtpServer = txtSMTP.Text Dim Message As MailMessage Message = New MailMessage() Message.From = txtFrom.Text Message.To = txtTo.Text Message.Subject = "Excellence.Net - Email" Message.Body = txtMessage.Text Message.BodyFormat = MailFormat.Text SmtpMail.Send(Message) Catch ex As Exception MsgBox(ex.ToString) End Try End If
All is ok - message pops up and asks yes or cancel, however if i click Cancel it still send the message? anybody kindly point me in the right direction?
Enable Option Strict.
-- Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
"MadCrazyNewbie" <te**@nospam.com> schrieb If MessageBox.Show("Are Your Sure You Want To Send This Email?", "Are Your Sure You Want To Send This Email?", MessageBoxButtons.OKCancel) Then [...]
All is ok - message pops up and asks yes or cancel, however if i click Cancel it still send the message? anybody kindly point me in the right direction?
Enable Option Strict.
I`ve enabled Options Strict On but now I get a message saying:
D:\Live Projects\Excellence.Net\EmailForm.vb(240): Option Strict On disallows implicit conversions from 'System.Windows.Forms.DialogResult' to 'Boolean'.
on If MessageBox.Show("Are Your Sure You Want To Send This Email?", "Are Your Sure You Want To Send This Email?", MessageBoxButtons.OKCancel) Then
Any Ideas?
The error message says everything you need:
- The return type of the show function is System.Windows.Forms.DialogResult.
- The If statement needs a boolean expression.
=> You have to compare the return value to one of the possible values to get
a boolean expression.
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
Hi Simon,
When you type the = the enum answer comes direct.
If MessageBox.Show("Are Your Sure You Want To Send This Email?", "Are Your
Sure You Want To Send This Email?", MessageBoxButtons.OKCancel) =
DialogResult.OK Then
Cor
You are testing if your messagebox returns True (boolean) while you are
using OK and Cancel buttons, neither of which return true.
"MadCrazyNewbie" <te**@nospam.com> wrote in message
news:R-********************@karoo.co.uk... Hey Group,
Sorry to be a pain again but i have the following code:
If MessageBox.Show("Are Your Sure You Want To Send This Email?", "Are Your Sure You Want To Send This Email?", MessageBoxButtons.OKCancel) Then Try SmtpMail.SmtpServer = txtSMTP.Text Dim Message As MailMessage Message = New MailMessage() Message.From = txtFrom.Text Message.To = txtTo.Text Message.Subject = "Excellence.Net - Email" Message.Body = txtMessage.Text Message.BodyFormat = MailFormat.Text SmtpMail.Send(Message) Catch ex As Exception MsgBox(ex.ToString) End Try End If
All is ok - message pops up and asks yes or cancel, however if i click Cancel it still send the message? anybody kindly point me in the right direction?
Ta MCN
MCN,
In addition to the other comments. If MessageBox.Show("Are Your Sure You Want To Send This Email?", "Are Your MsgBox(ex.ToString)
I would use one or the other version of MessageBox, not both within a single
program, so as to avoid incompatible parameters...
Of course if you upgraded an existing program and are slowing migrating to
one version than that's understandable... I would consider shadowing the
VB.MsgBox with my own, that has the ObsoleteAttribute on it, so as to
identify all the ones that I need to change... In addition to the
ObsoleteAttribute I would simply call the normal VB.MsgBox...
Hope this helps
Jay
"MadCrazyNewbie" <te**@nospam.com> wrote in message
news:R-********************@karoo.co.uk... Hey Group,
Sorry to be a pain again but i have the following code:
If MessageBox.Show("Are Your Sure You Want To Send This Email?", "Are Your Sure You Want To Send This Email?", MessageBoxButtons.OKCancel) Then Try SmtpMail.SmtpServer = txtSMTP.Text Dim Message As MailMessage Message = New MailMessage() Message.From = txtFrom.Text Message.To = txtTo.Text Message.Subject = "Excellence.Net - Email" Message.Body = txtMessage.Text Message.BodyFormat = MailFormat.Text SmtpMail.Send(Message) Catch ex As Exception MsgBox(ex.ToString) End Try End If
All is ok - message pops up and asks yes or cancel, however if i click Cancel it still send the message? anybody kindly point me in the right direction?
Ta MCN
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Adam |
last post by:
I am trying to inherit from MessageBox and i get error in
compilation time.
The code is:
public class MyMessageBox : MessageBox
{
public static DialogResult Show(int errorCode)
{
return...
|
by: Dennis C. Drumm |
last post by:
I have ordered the book .NET Framework Solutions, In Search of the Lost
Win32
API by John Paul Meuller which I think will help answer some of my questions
I have regarding making custom...
|
by: Saso Zagoranski |
last post by:
Hi!
I'm trying to make my own MessageBox... What I would like to know is, how
the MessageBox class is implemented?
I could have something like:
new MyMessageBox().ShowDialog();
but I would...
|
by: Sin |
last post by:
I'm currently evaluating VC.NET as the new platform for the company I work
for and things are looking grim... We're up against another IDE which took
me about 5 minutes to master and I've been...
|
by: Robert Heuvel |
last post by:
Hi,
this is what I did:
public struct SWaitCursor:IDisposable {
public SWaitCursor (int i) {
Cursor.Current = Cursors.WaitCursor;
}
void System.IDisposable.Dispose() {
Cursor.Current =...
|
by: Andrew |
last post by:
Hi,
I have a messagebox that pops up due to an event. I did it in javascript.
ie. alert("Time's up. Assessment Ended");
I want to capture the OK and Cancel events of this alert messagebox. My...
|
by: roberto |
last post by:
Hi at all
i have a web application (in vb.net), and i want to use a message box
control like System.Windows.Forms.MessageBox control, to show simple
messages . I used this but vb.net said
me an...
|
by: Larry Woods |
last post by:
I have a Messagebox that looks like:
MessageBox.Show("There are pending changes for this patient. Do you want to
continue to close?", "Pending Changes", MessageBoxButtons.YesNo,...
|
by: VMI |
last post by:
I know this isn't the best group to post aspnet question, but the MS asp.net
NG hasn't been very helpful lately.
I've been trying to add a messagebox following the examples I've seen on the
web,...
|
by: Goran Djuranovic |
last post by:
Hi all,
I have a VB.NET windows application that uses MDI form. When I try to delete a datagrid row from one of the MDI children forms, I use a MessageBox YesNo confirmation, which, after confirmed,...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |