|
Thanks for the proTip. I'm testing the object key for 'is nothing', I figured it would be the best place to start, this is where I get the error, on the first line of said conditional (if null etc...).
I have since discovered .contains, useful. Having jumped from C++/C all these VB short cuts and lack of pointers is giving me much fun/joy/sarcasm. Thanks for all your help though guys, there are some good snippets there.
|
|
|
|
|
Depending upon how you are pulling the value before comparing it, you may be able to check for nulls with the following statement:
If myValue Is DBNull.Value Then
'Handle the Null value
Else
'Value was not null
End If
Hope this helps.
|
|
|
|
|
I try to translate code from c++ to vb6,
in C++ i have:
unsigned char a = 3
unsigned char b = 188
unsigned char c
c = a^b
I get an answer c = 191.
I try the same in VB6
dim a as byte
dim b as byte
dim c as byte
a = 3
b = 188
c = a^B
I get Overflow
How do i get the same result ?
i tryed using combinations with MOD 256 but no success.
thanks.
|
|
|
|
|
Well, your basic problem is that you're using VB6, which was always crap, and has been unsupported for a long time. Why are you still using it ?
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.
|
|
|
|
|
Well, it is an additional feature im adding to a program allready written in VB6.
the question is what would be easier, coverting the whole program to smth else
or just trying to fix my problem.
|
|
|
|
|
It depends. If the program is going to live for a long time, I'd consider converting it to a real language.
If all else fails, you can do what VB6 users always did, get a C++ dll to do the real work. I don't know why the operation you're trying is failing, I suspect the answer is that the ^ does something different in VB6 to c++.
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.
|
|
|
|
|
IIRC it does.
^ in C/C++ is Bitwise Exclusive Or
^ in VB6 is exponentiation (raise to power)
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
"^" in C++ is bitwise XOR while in VB, it is power(exponent). Maybe that is the reason you are getting error.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Yep, I eventually figured it out,
im not so familiar with c++...
thanks.
|
|
|
|
|
using VB6 is a real bad idea. Use some newer Versions as Vb.net.
Always remember VB6 code isnt portable to VB.net, so VB6 is lost.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Hi
I need to shutdown remote systems running on windows xp with Dotnet Framework 1.1 installed. The user is limited on these machines.
I have used the following methods to shutdown the systems.
1. wmi
Dim oOS, oOperatingSystem As Object
oOS = GetObject("winmgmts:{(Shutdown)}").ExecQuery("Select * from Win32_OperatingSystem")
For Each oOperatingSystem In oOS
oOperatingSystem.Win32Shutdown(nForcePowerDown)
Next
2. shutdown.exe of xp
The problem is using the wmi sometime fails for reasons I don't know. The other method needs Admin privileges. Which is also an overhead.
What should I do? Use the API or there is some other way?
Please help as search over internet has not helped me much.
Thanks
reman
|
|
|
|
|
Let's just assume that your reasons for wanting to do this are entirely legitimate.
Think about it, if it were possible to just shut down a remote system, without admin privileges, what would keep hackers from doing so?
My advice is free, and you may get what you paid for.
|
|
|
|
|
If you want to do remote shutdown, you need Admin privileges on the remote machine to do it. There is no way around it, for obvious reasons.
|
|
|
|
|
Imports System.Net
Imports System.Net.NetworkInformation
Imports System.Text
Protected Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.Click
Public Shared Sub ShowTcpStatistics(ByVal version As NetworkInterfaceComponent)
Dim properties As IPGlobalProperties = IPGlobalProperties.GetIPGlobalProperties()
Dim tcpstat As TcpStatistics = Nothing
txtbox.Text("")
Select Case version
Case (NetworkInterfaceComponent.IPv4)
tcpstat = properties.GetTcpIPv4Statistics()
txtbox.Text("TCP/IPv4 Statistics:")
Exit Select
Case (NetworkInterfaceComponent.IPv6)
tcpstat = properties.GetTcpIPv6Statistics()
txtbox.Text("TCP/IPv6 Statistics:")
Exit Select
Case Else
Throw (New ArgumentException("version"))
' break;
End Select
txtbox.Text(" Minimum Transmission Timeout............. : {0}", tcpstat.MinimumTransmissionTimeout)
txtbox.Text(" Maximum Transmission Timeout............. : {0}", tcpstat.MaximumTransmissionTimeout)
txtbox.Text(" Connection Data:")
txtbox.Text(" Current ............................ : {0}", tcpstat.CurrentConnections)
txtbox.Text(" Cumulative .......................... : {0}", tcpstat.CumulativeConnections)
txtbox.Text(" Initiated ........................... : {0}", tcpstat.ConnectionsInitiated)
txtbox.Text(" Accepted ............................ : {0}", tcpstat.ConnectionsAccepted)
txtbox.Text(" Failed Attempts ..................... : {0}", tcpstat.FailedConnectionAttempts)
txtbox.Text(" Reset ............................... : {0}", tcpstat.ResetConnections)
txtbox.Text("")
txtbox.Text(" Segment Data:")
txtbox.Text(" Received ........................... : {0}", tcpstat.SegmentsReceived)
txtbox.Text(" Sent ................................ : {0}", tcpstat.SegmentsSent)
txtbox.Text(" Retransmitted ....................... : {0}", tcpstat.SegmentsResent)
txtbox.Text("")
End Sub
|
|
|
|
|
You should buy a very basic book and work through it berfore continuing this task.
You have a sub inside a sub. Remove the button4_click sub, or put an end sub at the bottom of it.
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 think the cause of the error is really quite obvious. You didn't terminate your Protected Sub Button4_Click() method with an End Sub before you started with Public Shared Sub ShowTcpStatistics() .
|
|
|
|
|
Protected Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.Click
ShowTcpStatistics(txtB.Text)
End Sub
Public Shared Sub ShowTcpStatistics(ByVal version As NetworkInterfaceComponent)
Dim properties As IPGlobalProperties = IPGlobalProperties.GetIPGlobalProperties()
Dim tcpstat As TcpStatistics = Nothing
txtbox.Text = ""
For Each tcp As TcpStatistics In tcpstat
txtbox = tcp.ToString()
Next
Select Case version
Case (NetworkInterfaceComponent.IPv4)
tcpstat = properties.GetTcpIPv4Statistics()
txtbox.Text("TCP/IPv4 Statistics:")
Exit Select
Case (NetworkInterfaceComponent.IPv6)
tcpstat = properties.GetTcpIPv6Statistics()
txtbox.Text("TCP/IPv6 Statistics:")
Exit Select
Case Else
Throw (New ArgumentException("version"))
' break;
End Select
txtbox.Text(" Minimum Transmission Timeout............. : {0}", tcpstat.MinimumTransmissionTimeout)
txtbox.Text(" Maximum Transmission Timeout............. : {0}", tcpstat.MaximumTransmissionTimeout)
txtbox.Text(" Connection Data:")
txtbox.Text(" Current ............................ : {0}", tcpstat.CurrentConnections)
txtbox.Text(" Cumulative .......................... : {0}", tcpstat.CumulativeConnections)
txtbox.Text(" Initiated ........................... : {0}", tcpstat.ConnectionsInitiated)
txtbox.Text(" Accepted ............................ : {0}", tcpstat.ConnectionsAccepted)
txtbox.Text(" Failed Attempts ..................... : {0}", tcpstat.FailedConnectionAttempts)
txtbox.Text(" Reset ............................... : {0}", tcpstat.ResetConnections)
txtbox.Text("")
txtbox.Text(" Segment Data:")
txtbox.Text(" Received ........................... : {0}", tcpstat.SegmentsReceived)
txtbox.Text(" Sent ................................ : {0}", tcpstat.SegmentsSent)
txtbox.Text(" Retransmitted ....................... : {0}", tcpstat.SegmentsResent)
txtbox.Text("")
End Sub
|
|
|
|
|
that_dude_tj wrote: txtbox.Text("TCP/IPv4 Statistics:")
Does this work ? What does it do ?
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.
|
|
|
|
|
not sure why he wrote that. it does not work. text has an overload but it only extracts the character position at the given number textbox1.text(3)
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
OK, that's interesting. It's a property AND a method ? I didn't know that. Either way, his response looked to me like a further question, but no question was present, so I was trying to guess the problem
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 just tried it. It probably is 2 properties that are overloaded 'a' = text for the example
Public ReadOnly Property a(ByVal idx As Int16) As String
Get
'extracts character at position
End Get
End Property
Public Property a() As String
Get
End Get
Set(ByVal value As String)
End Set
End Property
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
I'm not certain, but I think it's just a property. It returns String, and the String object has a built in indexer. Just like you could have a List(Of List(Of Integer)), and use lst(0)(1) and get an Integer back
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
No not working yet it suppose to display Internet Protocol version 4 (TCP/IPv4) statistical data for the local computer to my textbox name txtbox. i used this in the ping and it worked fine
Dim ping As Ping = New Ping()
Dim pingreply As PingReply = ping.Send(txtHost.Text)
txtPing.Text &= "Address: " & pingreply.Address.ToString() & Constants.vbCr
txtPing.Text &= "Roundtrip Time: " & pingreply.RoundtripTime & Constants.vbCr
txtPing.Text &= "TTL (Time to Live): " & pingreply.Options.Ttl & Constants.vbCr
txtPing.Text &= "Buffer Size: " & pingreply.Buffer.Length.ToString() & Constants.vbCr
|
|
|
|
|
So what's this?? You didn't ask a question and I'm not inclined to just start throwing test apps together to guess what you want out of this...
|
|
|
|
|
lol my question is then i would be. that im unable to display the tcp statistics in my text box
|
|
|
|