|
there is no try catch like .NET but u can use OnError goto
let's see with an example
Private Sub Command1_Click()
On Error GoTo ErrorHandler
Error 424 'This error is displayed when there is a missing object
Exit Sub
ErrorHandler:
MsgBox "Error Number: " & Err.Number & " With The Description ->> " & Err.Description & " <<- Occured."
End Sub
this is how you can handle exceptions, errors in VB6
hope it helps...
If the message is useful for U then please Rate This message...
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
hi
thanks for your help but now i have a problem, i paste the your code into my code , when there is no error the error msgbox will prompt the user.
this is how i code it
Private Sub CommandButton3_Click()
On Error GoTo ErrorHandler
Error 424 'This error is displayed when there is a missing object
Exit Sub
Dim Wk As Worksheet
Set Wk = Sheets.Add
ss = tbx_name.Text
Application.DisplayAlerts = False
Wk.Name = ss
ErrorHandler: MsgBox "Error Number: " & Err.Number & " With The Description ->> " & Err.Description & " <<- Occured."
End Sub
so whats wrong with it thanks
thanks
veon
|
|
|
|
|
Try following code
Private Sub CommandButton3_Click()
On Error GoTo ErrorHandlerError
Dim Wk As Worksheet
Set Wk = Sheets.Add
ss = tbx_name.Text
Application.DisplayAlerts = False
Wk.Name = ss
ErrorHandler:
MsgBox "Error Number: " & Err.Number & " With The Description ->> " & Err.Description & " <<- Occured."
End Sub
hope it helps....
If the message is useful for U then please Rate This message...
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
Hello,
for flight simulation I used the freeware PPJoy, with which I could connect my radio to the gameport and install it as a joystick. A very smart solution with no additional hardware needed except the cable.
Unfortunately my new computer doesn't have a gameport anymore nor a parallel port (all is USB). So I wonder if anyone would have an idea what I would have to do in order to connect the radio again? Maybe there are even coding solutions around, but I neither have an idea about the different signals nor which keywords to look for. Standing pretty much in the dark, all the messages I found by now sound like 'you need to buy more hardware'... but somehow I think that if I could connect to the gameport via software only, why shouldn't that be possible with the USB port?
Could someone please introduce me a bit?
Thank you
Michael
|
|
|
|
|
How on earth does a radio work as a joystick ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I'm glad that I'm not alone
Maybe the word is misleading: Radio means an RC controller, which - in some cases - can be connected to the PC via cable. The port e.g. detects (still: how?) the signals of X-Y-Z and throttle.
|
|
|
|
|
If the controller has a USB connection available, then you shouldn't have a problem. But, if all it has is a joystick connection, you simplay have no choice but to buy the extra hardware to get it connected to the PC.
|
|
|
|
|
hi i'm try send an email message
using System.Net Name space
<br />
Dim MailMSG As New MailMessage<br />
Dim SMTPSetting As New SmtpClient<br />
<br />
'===========================<br />
Dim _To As String = "To Address"<br />
Dim _From As String = "moeErrorNotifier@Gmail.com"<br />
Dim _GmailPass As String = "Password"<br />
Dim _moeHost As String = "HostURL"<br />
Dim _GmailHost As String = "smtp.gmail.com"<br />
'============================<br />
<br />
With MailMSG<br />
.To.Add(_To)<br />
.From = New MailAddress(_From)<br />
.Body = "Test Body"<br />
.IsBodyHtml = True<br />
.Subject = "Test Subject"<br />
End With <br />
With SMTPSetting<br />
.Host = _GmailHost<br />
.Credentials = New System.Net.NetworkCredential(_From, _GmailPass)<br />
.Port = 587<br />
.EnableSsl = True<br />
<br />
End With<br />
Try<br />
SMTPSetting.Send(MailMSG)<br />
Catch ex As Exception<br />
Throw ex<br />
End Try<br />
i'm working within domain
and this is the error:
Unable to read from the transport connection: net_io_Closed
modified on Sunday, July 19, 2009 8:59 AM
|
|
|
|
|
this is how you should Do it
MailMessage mm = new MailMessage();
SmtpClient smtp = new SmtpClient();
mm.From = new MailAddress("cc@gmail.com");
mm.To.Add(new MailAddress("cc@its.co.za"));
mm.To.Add(new MailAddress("cc@gmail.com"));
mm.Subject = "Hello";
mm.Body = "<p>This is the E-mail Test for !Booking System</p>";
mm.IsBodyHtml = true;
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential();
NetworkCred.UserName = "cc@gmail.com";
NetworkCred.Password = "oops i cant give you";
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 587;
smtp.Send(mm);
dont forget
using System.Net.Mail;
in the Using.
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
modified 30-Oct-11 2:13am.
|
|
|
|
|
Thanx for replay
but i think u just convert the code from vb.net to c#
|
|
|
|
|
the Example works Perfectly. give me your e-mail and send you a test mail.
use the http://converter.telerik.com/[^]
to convert to vb
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hello gurus,
am cofused right now.
I used this link Making TripleDES Simple in Visual Basic .NET[^]"> to do my encryption
and I have the following code section in my project to decrypt a data from database input:
datadapt = New System.Data.SqlClient.SqlDataAdapter(cmd)
ds = New DataSet
datadapt.Fill(ds)
' ds.Tables.Add(dt)
'datGrid.DataSource = ds.Tables(0)
cn.Close()
'Dim ind As Integer
Dim dc As DataColumn = New DataColumn
Dim dRow As DataRow
dRow = dt.NewRow
Dim i As Integer
Dim by As Byte
' For Each dRow In ds.Tables("Lab").Rows
For Each dRow In ds.Tables(0).Rows
For Each dc In ds.Tables(0).Columns
'If dc.DataType.ToString() = "System.String" Then
If dRow(dc).ToString = "system.Byte" Then
decData = New cTripleDES(key, iv)
Dim str As String = dRow(dc).ToString
For i = 0 To str.Length - 1
by = Convert.ToByte(str(i))
Next
'Dim by() As Byte = StrToByteArray(dRow(dc))
dRow(dc.Caption) = decData.Decrypt(by)
'deRecData = decData.Decrypt(by)
'dt.Rows.Add(deRecData)
'ds.Tables.Add(dt)
End If
Next
Next
datGrid.DataSource = ds.Tables(0)
The for loop should be able to retrieve the data in the encrypted form and then decrypt it.
I dont know if am doing the right thing, where did I get it wrong?
Thanks for ur help.
modified on Monday, July 20, 2009 6:13 AM
|
|
|
|
|
The language contructs are no different than C#. The two languages are very closely related because they both target the same MSIL.
|
|
|
|
|
Hi,
I'm pulling an inividual byte out of a byte array (I can't change the array), and that one byte needs to be treated as an SByte. As soon as the byte's value is >127 I get an overflow error as it's outside the range of SByte, and it's not automatically treated as a negative number (as it would be in C#).
I've tried CType and CSByte but no luck. The convert class appaently has the same problem.
Is there a standard way of dealing with this?
As a workaround I'm creating a temporary SByte array with one element and using Buffer.BlockCopy to copy from the original array to that, but it seems very much a hack.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Hi Dave,
C# doesn't flag overflows, VB.NET optionally checks for overflows, and does so by default.
Choose project properties/Compile/AdvancedCompileOptions to turn it off.
Now you can freely store a byte into an sbyte.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Thanks once again Luc - you're becoming my personal mentor
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Hi again Luc,
Well I think the code is now OK - I'm not getting any error, warnings or crashes!
If you have time, I'd appreciate your comments - the article is here[^]. Thanjs again
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
The problem I found was converting numbers that cause an overflow, and thus an exception. Whilst it is true that overflow checking may be turned off, I prefer not to. The code below should be self explanatory and solve the problem.
Public Function ConvertToSByte(ByVal b As Byte) As SByte
If b > 127 Then
Return (b - 256)
Else
Return b
End If
End Function
|
|
|
|
|
i want a piece of code to draw a table first and then each cell of the table has 3 cells itself
can anybody help me???!! (((((((((
|
|
|
|
|
Just for displays? Well, host it in a WebBrowser-control
$.02
|
|
|
|
|
Pretty straightforward to do, what have you coded thus far to accomplish this?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
hi experts,
I m making one application in vb.net in which for expiration purpose,i want to add cmos date in my application.but i dont know what is the proper code?
i can have datetime.now option with me,,but it wnt work as if end user changes the windows time,the desired functionality wnt be achieved.
I hope we ll solve this problem.
Reply soon
|
|
|
|
|
A recent thread on one of the CP forums insisted BIOS datetime and Windows datetime are basically identical: change one, the other changes too.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
BIOS and system date time go hand in hand. Hence, DateTime.Now is what you can use.
You are creating "evaluation version" sort of application I guess. Using system date for checking for expiry is not that safe approach (in fact most of approaches can be broken). You can use Registry to keep note of when the application was installed and then check if it has expired.
|
|
|
|
|
hi,thanks first,
ok,as per your saying,we can use registry..but i havnt worked on it..
can you tell me solution,,
reply soon
|
|
|
|