|
Try looking at the TcpClient, TcpListener and NetworkStream classes in the System.Net namespace.
|
|
|
|
|
As the subject suggest how can i monitor CPU.
|
|
|
|
|
Maybe this[^] is what you're looking for?
Pompiedompiedom...
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick
|
|
|
|
|
Hi All ,
how can i receive the ip address from a remote client?
im using this code to listen to a client:
dim PORT as integer = 10000
listener = New Sockets.TcpListener(System.Net.IPAddress.Any, PORT)
listener.Start()
Dim client As TcpClient = listener.AcceptTcpClient()
now i need the client ip address ?....
|
|
|
|
|
hey all,
Does anyone know, how to determine the port of a printer? I need this to know because my application allows a user to select a printer but all print jobs are send directly to the port (i.E. "copy print.txt LPT1").
I do not find any information abount this
I'm using VB.NET 1.1
thx, bernd
|
|
|
|
|
The GetPrinter API can be used from VB.Net to get this info.
'--8<------------------------
Ex Datis:
Duncan Jones
Merrion Computing Ltd
|
|
|
|
|
Thx very much !!
after knowing what i am looking for i found this:
<DllImport("winspool.drv", CharSet:=CharSet.Auto, SetLastError:=True)> _
Private Shared Function OpenPrinter( _
ByVal pPrinterName As String, ByRef hPrinter As IntPtr, _
ByVal pDefault As IntPtr) As Boolean
End Function
<DllImport("winspool.drv", CharSet:=CharSet.Auto, _
SetLastError:=True)> _
Private Shared Function ClosePrinter( _
ByVal hPrinter As IntPtr) As Boolean
End Function
<DllImport("winspool.drv", CharSet:=CharSet.Auto, _
SetLastError:=True)> _
Private Shared Function GetPrinter( _
ByVal hPrinter As IntPtr, ByVal dwLevel As Integer, _
ByVal pPrinter As IntPtr, ByVal cbBuf As Integer, _
ByRef pcbNeeded As Integer) As Boolean
End Function
Private Shared Function GetPrinterInfo(ByVal printerName As String) As PRINTER_INFO_2
Dim hPrinter As IntPtr
If Not OpenPrinter(printerName, hPrinter, IntPtr.Zero) Then
Throw New Win32Exception(Marshal.GetLastWin32Error())
End If
Dim pPrinterInfo As IntPtr = IntPtr.Zero
Try
Dim needed As Integer
GetPrinter(hPrinter, 2, IntPtr.Zero, 0, needed)
If needed <= 0 Then
Throw New Exception("Na Zeavas...")
End If
pPrinterInfo = Marshal.AllocHGlobal(needed)
Dim temp As Integer
If Not GetPrinter(hPrinter, 2, pPrinterInfo, needed, temp) Then
Throw New Win32Exception(Marshal.GetLastWin32Error())
End If
Dim printerInfo As PRINTER_INFO_2 = _
CType(Marshal.PtrToStructure( _
pPrinterInfo, GetType(PRINTER_INFO_2)), PRINTER_INFO_2)
Return printerInfo
Finally
ClosePrinter(hPrinter)
Marshal.FreeHGlobal(pPrinterInfo)
End Try
End Function
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)> _
Public Structure PRINTER_INFO_2
Public pServerName As String
Public pPrinterName As String
Public pShareName As String
Public pPortName As String
Public pDriverName As String
Public pComment As String
Public pLocation As String
Public pDevMode As IntPtr
Public pSepFile As String
Public pPrintProcessor As String
Public pDatatype As String
Public pParameters As String
Public pSecurityDescriptor As IntPtr
Public Attributes As System.UInt32
Public Priority As System.UInt32
Public DefaultPriority As System.UInt32
Public StartTime As System.UInt32
Public UntilTime As System.UInt32
Public Status As System.UInt32
Public cJobs As System.UInt32
Public AveragePPM As System.UInt32
End Structure
|
|
|
|
|
Hi,
Cud you suggest me a way to bind one textbox with two tables?
i'l tell u the actual situation.
I am having n text box on a tab page.Some of the textboxes get the data from a previously filled table.i need to fill data in other textboxes and want to save the data of all the text boxes in another table.
Im having a primary data in one of the textboxs and many records for that primary data has to be saved n times.
Thanx
|
|
|
|
|
Hi,
I am new in VB.net. I have a problem while debugging a windows application, which will read a bmp image and save it after processing. I used the following code
//Opening an image
private sub button1_click (Byval sender as object,Byval e as system.eventergs)
dim odlg as new openfiledialog()
odlg.filter = "Bitmap(*.bmp)|*.bmp"
if (odlg.showdialog=dialogresult.ok) then
picturebox1.image = image.fromfile(odlg.filename)
picturebox1.invalidate()
end if
end sub
//Saving an Image
private sub button2_click (Byval sender as object,Byval e as system.eventergs)
dim sdlg as new savefiledialog()
sdlg.filter = "Bitmap(*.bmp)|*.bmp"
if (sdlg.showdialog=dialogresult.ok) then
picturebox1.image.save(sdlg.filename)
picturebox1.invalidate()
end if
end sub
While I open an image "b.bmp" and after processing it want to overwrite the file with the same filename (b.bmp) an error occurs, saying:
"An unhandled exception of type
System.Runtime.InteropServices.ExternalException occurred in System.Drawing.dll
Additional information: A generic error occurred in GDI+."
What should I do now, how can i overcome this problem?
Please help me. Thanks in advance.
Anindya Chatterjee
|
|
|
|
|
how to add a combobox to a datagrid column in datagrid. also for this how to create the user control
|
|
|
|
|
|
|
u r trying to back up as database from that database only
thats why this msg is coming try changing the database and then taking the back up.
it worked with me ..
it may also help u.
abhinav
|
|
|
|
|
Thank u abhinav. it worked fantastically. thank u.
Roy Joseph
|
|
|
|
|
Hi,
if I develop a Usercontrol with VB.Net, it is easy to give a own Property a Default-Value. But I want to give the Font-Property a Default-Value (a other like the System-Default). How can I do that?
Vocaris
|
|
|
|
|
You can do that in your constructor.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Ah thx shure, I think last night was too long
|
|
|
|
|
DefaultValue attribute only works for simple values. For complicated stuff (like that the default value depends on other properties), you can use ShouldSerialize[PropertyName] & Reset[PropertyName] . Example:
Private _someFont As New Font("verdana", 12.0!)
Public Property SomeFont As Font
Get
Return _someFont
End Get
Set(Value As Font)
If Not Font.Equals(_someFont, Value) Then
_someFont = Value
End If
End Set
End Property
Public Function ShouldSerializeSomeFont As Boolean
Static default As New Font("verdana", 12.0!)
If Font.Equals(SomeFont, default)
Return False
Else : Return True
End If
End Function
Public Sub ResetSomeFont
If Not SomeFont Is Nothing Then
SomeFont.Dispose()
End If
SomeFont = New Font("verdana", 12.0!)
End Sub HTH
Pompiedompiedom...
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick
|
|
|
|
|
Thanks for answering, I didn't know about the 'ShouldSerialize' and 'Reset' functions. but now after knowing about these function I can use them.
Thanks
|
|
|
|
|
This is probably a very dumb rookie question. But its too late and I want to go to bed
I have a button, and a label. When I click the button I want the label to go from 1, then to 2, 3 etc.
So obviosuly I need a
Dim i as integer
i = 0
and when I click the button a
i = i + 1
label.text = i
But the problem is that i cant seem to put the integer decleration anywhere that doesn't refresh the value. If I put a Public i as integer at the top, all I get when I click the button is 1 again and again.
I also put the code to insert it into a list box. And all I got were 1, 11, 111,1111 etc but obviously downward.
So how do I declare a "global" integer that will hold the value after it has been changed?
Like I said its probably unbelievably simple. But its slumber time for me. Hopefully I will have my answer when I wake up.
Cheers.
|
|
|
|
|
daviiie wrote: But the problem is that i cant seem to put the integer decleration anywhere that doesn't refresh the value.
Is this asp.net ? If not, I don't see why a member variable wouldn't work. If it is, you need to store it in viewstate or sessionstate.
The other option if you have only one is to make it static, but I'm not sure it would help here.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
make the variable static not initialise it 0 .
Use the Following Code
Private Sub Command1_Click()
Static i As Integer
i = i + 1
Label1.Caption = i
End Sub
manoj
|
|
|
|
|
VB.net 2005
when I set the server to non blocking I get the following error
"A non-blocking socket operation could not be completed immediately"
example
Dim serverSocket As New Socket( _
localEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp)
serverSocket.Blocking = False
Try
serverSocket.Bind(localEndPoint)
serverSocket.Listen(Integer.MaxValue)
Console.WriteLine("Server started.")
While True
Try
Dim clientSocket As Socket = serverSocket.Accept()
As soon as I dim the Client socket I get the error.
If I set the "serverSocket.Blocking = True" then every thing works fine.
Any help would be appreciated.
mpage
|
|
|
|
|
Hi, I'm currently making a program where I have a set of lines that "glow". In other words I have a timer that decreases or increases the gradient of the colour at every interval. I've found this to work quite successfully with one line, but when I use multiple lines, they start to flicker randomly like they're refreshing or something. I know VB6 doesn't have the best graphics capabilities, but if anyone has a solution to stop this flickering or infact another explanation, it would be much appreciated. Thanks, Hoopla!
|
|
|
|
|
AS you say, VB6 is not the way to do this. Why use VB6 in 2005 anyhow ?
As VB6 has no double buffering built in, you need to do your own. Draw your lines onto a bitmap, and copy that bitmap to the screen in your OnPaint. This means you need one bitmap to show, and another that you're drawing on.
Christian Graus - Microsoft MVP - C++
|
|
|
|