|
I thought that in .net it didn't work that way..off a post I saw about finding out how a form is closed, but I cuold be wrong. How about using a Main sub in a module to launch the form? May be a possible work around...have to play with that one.
|
|
|
|
|
hi
i saw your problem and as Dave said maybe you close the startup form
and say you want to make a splash screen ? if you want say about it and i'll write you a sample program about this.
with best wishes
smart_sdr
|
|
|
|
|
It works that way in ALL Windows applications. There is always a parent form that gets executed and becomes an application-level message loop. And yes, you can have a Sub Main that executes, using Application.Run( Form ) , that will start your app's application message pump.
Now, there's nothing that say you only have to have one Application.Run statement. Just search the Articles for "Splash Screen" and you'll see what I mean.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hellow to all ...
i am making a drawing program that contain basic drawing options ...
i have a problem when i wana save the photo that it is a pictuerbox it erased !
anyidea !
|
|
|
|
|
Without seeing your save code, it's impossible to tell you what you did wrong!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dim sFileName As String
Dim oFormat As System.Drawing.Imaging.ImageFormat
If SaveFileDialog1.ShowDialog = DialogResult.OK Then
sFileName = SaveFileDialog1.FileName
oFormat = System.Drawing.Imaging.ImageFormat.Bmp
Me.PictureBox1.Image.Save(sFileName, oFormat)
|
|
|
|
|
What are you drawing on? If your just getting the Graphics objects for the picturebox control, you're not drawing on this image that your trying to save. You're drawing on the surface of the control.
You should be getting the graphics object of the Image, not the control.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i repeated this question again, i wrote it in the SQL / ADO / ADO.NET (Programming Forums).
I'm reading a book "Network Programming in .Net with C# and Visual Basic.Net" by Fiach Reid
im now in the chapter 3 "Working with the sockets"
and im trying to execute the program that's starting at the page 82
and i received an error.Then i put a breakpoint to see what's the problem
then i saw that the problem happened in the Sub "acceptHandler" and this is the snippet code :
Public Sub acceptHandler(ByVal asyncResult As IAsyncResult)
receiveCallBack = New AsyncCallback(AddressOf receiveHandler)
'listenerSocket here = Nothing and i don't know why ?
clientSocket = listenerSocket.EndAccept(asyncResult)
recv = New Byte(1) {}
clientSocket.BeginReceive(recv, 0, 1, _
SocketFlags.None, receiveCallBack, Nothing)
End Sub
i don't know why listenerSocket in this code = Nothing
so this is the problem.
Smart_sdr
|
|
|
|
|
You're going to have to follow the code and find out where listenerSocket is defined and where it's being assigned an object. Since I don't have the book, I can't possibly tell you what you did wrong.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks to you Dave for your response.
I'll put the code here :
you put textbox and name it "tbStatus"
and put a button and name it "btnListen"
and this is the code as its from the book
after you run the program open the command prompt and write :
telnet "your ip address" 8080
and then the program will enter the sub "acceptHandler" and it will and
error cause the listenerSocket = Nothing
-------------------------- code ----------------
Imports System.Text
Imports System.Net.Sockets
Imports System.Net
Public Class Form1
Inherits System.Windows.Forms.Form
" Windows Form Designer generated code "
Private acceptCallBack As AsyncCallback
Private receiveCallBack As AsyncCallback
Public listenerSocket As Socket
Public clientSocket As Socket
Public recv() As Byte
Public Sub acceptHandler(ByVal asyncResult As IAsyncResult)
receiveCallBack = New AsyncCallback(AddressOf receiveHandler)
clientSocket = listenerSocket.EndAccept(asyncResult)
recv = New Byte(1) {}
clientSocket.BeginReceive(recv, 0, 1, _
SocketFlags.None, receiveCallBack, Nothing)
End Sub
Public Sub receiveHandler(ByVal asyncResult As _
IAsyncResult)
Dim bytesReceived As Integer = 0
bytesReceived = clientSocket.EndReceive(asyncResult)
If bytesReceived <> 0 Then
tbStatus.Text += Encoding.UTF8.GetString(recv)
recv = New Byte(1) {}
clientSocket.BeginReceive(recv, 0, 1, _
SocketFlags.None, receiveCallBack, Nothing)
End If
End Sub
Private Sub btnListen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnListen.Click
acceptCallBack = New AsyncCallback(AddressOf _
acceptHandler)
Dim listenerSocket As Socket = New Socket( _
AddressFamily.InterNetwork, _
SocketType.Stream, _
ProtocolType.Tcp _
)
Dim IPHost As IPHostEntry = _
Dns.GetHostByName(Dns.GetHostName())
Dim ipepServer As IPEndPoint = New _
IPEndPoint(IPHost.AddressList(0), 8080)
listenerSocket.Bind(ipepServer)
listenerSocket.Listen(-1)
listenerSocket.BeginAccept(acceptCallBack, Nothing)
End Sub
End Class
---------------------------- end of code ------------------
with best wishes
smart_sdr
|
|
|
|
|
I don't see anything much wrong with the code, but there are two things...
1) This may seem stupid, but did you click on the Listen button to start your listener before your tried to connect to it with "telnet whatever 8080"?
2) smart_sdr wrote:
Dim IPHost As IPHostEntry = _
Dns.GetHostByName(Dns.GetHostName())
Dim ipepServer As IPEndPoint = New _
IPEndPoint(IPHost.AddressList(0), 8080)
Did IPHost.AddressList(0) return an address? Stop the code on this line and use the debugger to check to values in IPHost .
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Dave,
about IPHost.Address(0), sure it contains a value,
also the code will execute :
listenerSocket.BeginAccept(acceptCallBack, Nothing)
will wait at the port 8080 and will enter "acceptHandler"
when you execute "telnet "your ip address" 8080"
and then you will find that listenerSocket=Nothing !
i put a breakpoint at the statement :
clientSocket = listenerSocket.EndAccept(asyncResult) ' in the Sub "acceptHandler"
and thanks for your response
with best wishes
smart_sdr
|
|
|
|
|
I didn't see this before, but the problem is because you're not assigning a new object to your class-level listenerSocket . You're defining a new, local one and it's dropping out of scope at then end of this sub:
Private Sub btnListen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnListen.Click
acceptCallBack = New AsyncCallback(AddressOf _
acceptHandler)
Dim listenerSocket As Socket = New Socket( _
AddressFamily.InterNetwork, _
SocketType.Stream, _
ProtocolType.Tcp _
)
Remove the Dim from the listenerSocket line:
listenerSocket As Socket = New Socket( _
AddressFamily.InterNetwork, _
SocketType.Stream, _
ProtocolType.Tcp _
)
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks Dave for your attention
maybe i was sleeping and i didn't pay attention to this thing.
thanks again
smart_sdr
|
|
|
|
|
Dave if you don't have a book i can send it to you by e-mail.
if you want.
smart_sdr
|
|
|
|
|
Hai...
I need TO SPLIT THE wave file, how to do that using vb. Please let me know.
Thanks,
E.Veera Raghavendra
|
|
|
|
|
Veera,
I'll try to help you but..
What do you mean by "split the wave file"?
Do you want to edit it? .. Or get a section of it? ... or what?
progload
|
|
|
|
|
If the wave file is large i want to divide into sections and to be read the section.
Thanks,
E.Veera Raghavendra.
|
|
|
|
|
|
Hai..
It is not helpful to me needs. Presently I am able to play the wave file and displaying the wave signal. But if the wav file is large, tkaing time to load. So i need to read some part of the file each time.
thanking you,
E.Veera Raghavendra.
|
|
|
|
|
Can anybody have any idea how can i prevent exe's to execute through vb6 and specially to dave Iam not making any Virus , Ijust want to demonstrate to my friends .
|
|
|
|
|
No, to write a virus, even a pretend one, requires a real programming language, not VB6.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Can't be done in VB6. Also, the only way you're going to this is by getting Group Policies and setting up the "Dont run specified Windows applications" policy.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Actually,I have an exe which i get through my close friend
and well he also get the code from somewhere else , is it possible in vc++ or pure window programming under C,
and dave group policies mean the policy editor which we open gpedit.msc in xp and then writing the registry entry or that is something else.
|
|
|
|
|
chanu1982@rediffmail.com wrote:
is it possible in vc++
Yes.
chanu1982@rediffmail.com wrote:
group policies mean the policy editor which we open gpedit.msc in xp and then writing the registry entry or that is something else.
GPEDIT stands for "Group Policy Editor".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|