|
Well I feel kind of silly because just a few hours after I posted this question I found the answer I was looking for and again with the information I found on this site I was able to do what my users wanted. But in my defence I did look around for many hours before asking!
Let me take the time though to say that this site and the people coming to it to help absolutely ROCK! I have not found any other site on the internet that helps those in need as much as this one does. Keep up the wonderful work people.
|
|
|
|
|
I don't get it...I'm pretty new to VB.NET and programming in general and I've written this class that is supposed to get TCP statistics:
'------------------HERE IT BEGINS------------------------------------
Imports System.net
Imports System.net.NetworkInformation
Public Class TcpStats
Public stats As Long()
Public Sub ShowTcpStats(ByVal version As NetworkInterfaceComponent)
Try
Dim properties As IPGlobalProperties = IPGlobalProperties.GetIPGlobalProperties
Dim tcpstat As TcpStatistics
Select Case version
Case NetworkInterfaceComponent.IPv4
tcpstat = properties.GetTcpIPv4Statistics
Case NetworkInterfaceComponent.IPv6
tcpstat = properties.GetTcpIPv6Statistics
Case Else
Throw New ArgumentException("version")
End Select
stats(0) = tcpstat.MinimumTransmissionTimeout
stats(1) = tcpstat.MaximumTransmissionTimeout
stats(2) = tcpstat.CurrentConnections
stats(3) = tcpstat.CumulativeConnections
stats(4) = tcpstat.ConnectionsInitiated
stats(5) = tcpstat.ConnectionsAccepted
stats(6) = tcpstat.FailedConnectionAttempts
stats(7) = tcpstat.ResetConnections
stats(8) = tcpstat.SegmentsReceived
stats(9) = tcpstat.SegmentsSent
stats(10) = tcpstat.SegmentsResent
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class
--------------------HERE IT ENDS--------------------------------
This is how i instantiate the class from the main form:
------------------- HERE IT BEGINS------------------------------
Imports System.net
Imports System.net.NetworkInformation
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Instantiating my class
Dim tcpstats As New TcpStats
'Calling the ShowTcpStats procedure in my class
tcpstats.ShowTcpStats(NetworkInterfaceComponent.IPv4)
'Here is a list into which I add the statistics
Me.lstTcpStats.Items.Add(tcpstats.stats(0))
Me.lstTcpStats.Items.Add(tcpstats.stats(1))
Me.lstTcpStats.Items.Add(tcpstats.stats(2))
'And so on....
End Sub
End Class
-------------------HERE IT ENDS----------------------------------
problem is, when I execute the program the properties object of the IPGlobalProperties class is Nothing
so i get a NullReferenceExeption.
Can anyone tell me why? What I'm doing wrong?
Kind regards V
|
|
|
|
|
How to use Inheritance in VB 6.0?
It's very easy:-
Declare an Global variable and use it whenever needed
But in case of forms, make few changes only:-
Declare form variable without New keyword.
Like, Dim Fr as Form1.
And the Form1 is Inherited. Now i can do any thing with Form1. I can get any thing like Form backColor, ForColor, Size, Location, etc. Like you can see it in my " Floating Control Box" Article (named - Window Control 1.0).
It was very hard use Inheritance in Visual Basic 6.0.
But known it is very ease to use Inheritance.
-- modified at 5:59 Sunday 19th March, 2006
|
|
|
|
|
Is there is a point to this little speech of yours?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How do I open a Form from another Form?
newtWales
|
|
|
|
|
Create a new instance of the form you would like to open and call the Show ( or ShowDialog) method on the created object.
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Dim newForm As New Form2
newForm.Show()
' or
Dim dr As DialogResult
dr = newForm.ShowDialog()
' Do something with the DialogResult...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thats for version 1 and 1.1 but in 2 i have noticed that u can do it the old fationed way like in vb6 where u dont have to do the whole Dim newForm As New Form2. u can just newForm.Show().
|
|
|
|
|
ACtually, the libraries in VB.NET2005 are doing that very thing for you. Just because you CAN do it in VB.NET, doesn't mean you SHOULD be doing it.
Any VB6 project run through the Upgrade Wizard in VS.NET 2002, 2003, or 2005, will do the same thing.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I noticed that when I run some Dotnet programs the icons in the background (XP desktop) flicker regularly.
I tried to find out what is happening and I managed to reproduce the problem with five lines of codes.
I hopesomeone will be kind enough to test that on their machine and tell me if they reproduce it or not.
You just need to
1 - create a new Windows Forms application.
2 - add a numericupdown control in the middle of the form
3 - set the numericupdown1 maximum to 1000
4 - Add this code:
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
For i As Integer = 1 To NumericUpDown1.Value
e.Graphics.DrawLine(Pens.Red, 10 + i, 10, 10 + i, 10 + i)
Next
End Sub
Private Sub NumericUpDown1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown1.ValueChanged
Me.Invalidate()
End Sub
Then when you click on the NumericDown control and reach 150 (on my machine) the icons on the background are starting to refresh...
Do you reproduce that ?
|
|
|
|
|
Please don't cross post.
---
b { font-weight: normal; }
|
|
|
|
|
Very strange. But, no, I couldn't reproduce the problem on my machines.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Pals
I am working on vb.net 2005 windows forms.
I want to display an image using directx control. I have the documentation too of directx sdk but it describes all usage through c# interface. So cant understand anything basically.
So If anyone can give me some example to display an image using directx direct3d functionality then that would be really very helpfull to me.
Thanks in advance.
MAP Tiger
|
|
|
|
|
i have a mdi application, and on the main mdi container, i have a menu strip that i want to add icons to. how do i go abt it? thanx in advance.
Regards,
Kuda.
|
|
|
|
|
If you are using VB 2005 didn't you notice the Image property.
If you are using VB 2003 there are many articles in CP
Chatura from Pearl of the Indian Ocean
|
|
|
|
|
Hie Chataura,
am using VB 2003 and dont seem to find what you said. So may you please clarify.
Regards,
Kuda.
|
|
|
|
|
Hi
Im using Crystal Reports to produce Summary Reports from my Database
( Fields - Task, Date, Duration). The Report is showing a list of my data held in my database with the headings Task, Date and Duration.
I'm trying to get the Crystal Report Expert to have a Total Duration at the end of the report. This would need to accumalate all the durations which are in the format of 00:00:00 (hrs:mins:secs).
How can I use the Crystal Report to produce a Total of all the durations? Is there a formula I need to use?
Regards
ensuvari
|
|
|
|
|
Hello!
I started getting an error message when I try to save the image under a directory. The error message is
EXTERNAL EXCEPTION WAS UNHANDLED
A GENERIC ERROR OCCURED IN GDI+
The message is point to following statement.
Picturebox1.image.save ("c:\abcd.jpg", ImageFormat.jpg)
if you enlight me about the solution I would really appreciate it...
Thanks..
|
|
|
|
|
Whatever account your application is running under doesn't have write permissions to C:\.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Dave!
Whenever the application copies files from CD or any other driver to local hardisk, I haven't met with any type of permission problems. They are working fine. I am able to save the pictures files under a directoy on my local hard disk as a file.
Why do you think whenever picturebox1.image.save is used cause such a problem.
Thanks!
|
|
|
|
|
Based on the infom you've given, you might also want to try checking out this[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I finally detected the proplem... One sub directory name was missing in the path.. Now it is working... Thanks for the URL.
|
|
|
|
|
I kind figured it had to be something filesystem related...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I am using datareader to simulate the records.(First , Previous , Last , Next)Buttons . I had not used sqldataadapter for add , delete , update buttons.I want to continue with the sqldatareader for first , previous , last , next buttons.Can somebody send me any code or link.
Thanks
|
|
|
|
|
You can't use a DataReader for Forward/Backward navigation. It's a forward-only reader.
You'll have to use a DataAdapter and DataSet for this.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|