|
It's not counter-intuitive, really. If you have to that you need to execute from two of more different functions/methods, move that code to it's own function/method and call it from wherever you need with whatever parameters you need. It's much easier than trying to figure out how to create event parameters from scratch.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Sorry mate, but your comment doesn't help me at all. I found it a little hard to understand actually.
It's not about catching or handling an event, but simulating a user's keytouch. This is because there is no way to open a dateTimePicker's calendar dropdown from code (or at least none that I can find) so in order to make it appear, you could raise a keypress event which would then be automatically handled by the control and make the calendar appear.
Is this any clearer?
_____________________
Don't take out the Magic Pen,
Don't draw on the Infinity Board
- Neil Young
|
|
|
|
|
Don't know if this is the best way to do what you want, but...
Find the control window handle using the FindWindowEx API. Then use the SendMessage API to send it a message that simulates a left button mouse click.
The tricky part is that a DateTimePicker behaves differently depending on where you click on it. But the control itself only exposes a single hwnd for the entire control.
So you will have to figure out the correct message parameters to make it think you clicked on the drop button instead of the in the date text area.
Run an application that has a DTPicker control, then use the Spy++ tool to log WM_USER and all mouse related messages, and study the results. Then it is matter of tinkering with the message parameters until you find what works.
Good Luck ...
Robert
|
|
|
|
|
Cheers for your help, Robert.
I'm not 100% on how to use FindWindowEx just yet, but a little net research will probably clear that up. I get the general idea, but how to use some of the parameters will take a bit more thinking.
Cheers mate,
kutz
_____________________
Don't take out the Magic Pen,
Don't draw on the Infinity Board
- Neil Young
|
|
|
|
|
Hi...
I am a new user to VB.net so bear with me. When I send the focus to a control, the cursor then appears (flashing) in the control. Perfect! However, the mouse pointer also disappears when this happens. Is there a way using code to have the mouse pointer re-appear (Get focus?) prior to the control losing focus? I have tried to reposition the mouse but it does not appear to work. Must I...
Repaint the screen?
Redraw the mouse?
Thanks for the help
Pat
|
|
|
|
|
The mouse doesn't disappear for me. Could this be a setting in your Mouse Control Panel?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Dave
I am glad that you are not experiencing the same problem. But my question remains. Do you know how to re-position the mouse using code?
I have tried the following but it does not appear to help.
Me.MousePosition.X.Equals(78)
Me.MousePosition.Y.Equals(154)
Explanation
I have three Controls:
Control1 is a Text box.
Control2 is a Dropdown box.
Control3 is a Command Button.
Control1 is visible and 'layered' overtop of Control2 which is invisible. On-click of Button the focus is sent to Control1. Upon typing a textual filter, in Control1, I use the 'Leave' event to perform the following. Control1 becomes invisible, Control2 becomes visible and drops down displaying the filtered results of the dataset. All works very well.
Unfortunately (and here is where my problem presents itself) my mouse pointer 'gets caught' inside the Control2 Dropdown. It will only move within the Dropdown choices.
However, if I move my mouse ever so slightly prior to leaving Control1, the problem does not manifest itself. I have tried sending the focus away from Control1 as the first statement in the 'Leave' sub, but it still gets caught. This is why I thought perhaps I should move my mouse ever so slightly using code rather than sending the focus somewhere else. Using this logic, the mouse pointer would reappear (similar to if I manually moved the mouse) prior to the pressing of the Tab Key and calling the Leave Sub.
Any help would be appreciated.
Thanks
Pat
|
|
|
|
|
capilano wrote:
Me.MousePosition.X.Equals(78)
Me.MousePosition.Y.Equals(154)
Well, that's no going to work, because MousePosition is a ReadOnly property. The .Equals() that you used just compares the number in parenthesis to the mouse position value and returns True or False if they are equal.
You might want to try Me.Invalidate(True) in the Leave event to force the entire form to paint itself, child controls too. Keep in mind this is not a solution, but used to test a theory. The mouse cursor should appear on top of everything after the paint.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have an ADO control on my program and I would like to do a "find" of a criteria within a specific field in the database. I am using .mdb file for my database.
Please let me know if you have any simple examples of this.
Thanks,
-=BHBADZ=-
|
|
|
|
|
Search the MSDN, and you will find examples.
|
|
|
|
|
I have 2 computer i a LAN, witch is connected to the internet.
Comp1. Ip = 192.168.0.195
Comp2. Ip = 192.168.0.163
My router is set up to forward port 12000 to comp2.
Comp1 acts as a server. It sends data using UDPClient.
<br />
'Uses the IP address and port number to establish a socket connection.<br />
udpClient = New UdpClient<br />
Dim ipAddress As IPAddress = Dns.Resolve("my internet IPaddress").AddressList(0)<br />
Try<br />
udpClient.Connect(ipAddress, 12000)<br />
Catch ex As Exception<br />
Console.WriteLine(ex.ToString())<br />
End Try<br />
<br />
udpClient.Send(Data, Data.Length)<br />
Comp2 acts as a client. It receives data using UDPClient.
<br />
Dim receivingUdpClient As New UdpClient(12000)<br />
Dim RemoteIpEndPoint As New IPEndPoint(IPAddress.Any, 0)<br />
<br />
Do<br />
Try<br />
Data = receivingUdpClient.Receive(RemoteIpEndPoint)<br />
...<br />
....<br />
Comp2 doesn’t receive anything.
BUT... if Comp1 is setup like this
<br />
'Uses the IP address and port number to establish a socket connection.<br />
udpClient = New UdpClient<br />
Dim ipAddress As IPAddress = Dns.Resolve("192.168.0.163").AddressList(0)<br />
Try<br />
udpClient.Connect(ipAddress, 12000)<br />
Catch ex As Exception<br />
Console.WriteLine(ex.ToString())<br />
End Try<br />
<br />
udpClient.Send(Data, Data.Length)
Then it works.
The only changes I made is, instead of using my internet adr. I used my locale adr.
Any idea why???
|
|
|
|
|
I would double check the router configuration to make sure that it is indeed sending the information to the correct local IP address. Also, make sure that the default gateway on the machines in the local IP address of the router. And, finally, do you have any firewall software running on the machines?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I can see the data is ariving at the client... LAN-connection in the traybar
but the program doesn't receive the data.
NetLimiter shows that the client program has NO connections.
|
|
|
|
|
Once again, do you have a firewall running on that machine? If so, disable it and see what happens...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
No firewall's at all. and turned off in router.
Is it cuz i'm sending and receiving on the same internet ip-address? (just for testing)
|
|
|
|
|
I've got a strange feeling about this one. Try your code from a test machine outside your router. Try it on a friends machine from his/her house connecting back to your internet IP address. I get the feeling that either the router is still misconfigured somehow, or there's something you haven't told us about your UDP connection.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
ok, thanks.
I'm making a small prog witch sends data to my internet ip every 3 sec.
Then running the prog from another computer (diff. IP).
And a little prog. witch try's to receive the data, and running it from my computer.
|
|
|
|
|
Hmmm....
The only code that works is:
<br />
Dim rxSocket As Socket = Nothing<br />
Dim RecvBytes(1000) As Byte<br />
Dim RemoteEP As New IPEndPoint(0, 0)<br />
Dim myCallback As New AsyncCallback(AddressOf OnReceive)<br />
<br />
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
rxSocket = New Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)<br />
RemoteEP = New IPEndPoint(IPAddress.Any, 12000)<br />
rxSocket.Bind(RemoteEP)<br />
rxSocket.BeginReceiveFrom(RecvBytes, 0, RecvBytes.Length, _<br />
SocketFlags.None, RemoteEP, myCallback, Nothing)<br />
End Sub<br />
<br />
<br />
Public Sub OnReceive(ByVal ar As IAsyncResult)<br />
Dim iBytes As Integer<br />
Try<br />
<br />
Catch e As SocketException<br />
MsgBox(e.Message)<br />
Exit Sub<br />
End Try<br />
ListView1.Items.Add(System.Text.Encoding.UTF8.GetString(RecvBytes))<br />
iBytes = rxSocket.EndReceiveFrom(ar, RemoteEP)<br />
rxSocket.BeginReceiveFrom(RecvBytes, 0, RecvBytes.Length, _<br />
SocketFlags.None, RemoteEP, myCallback, Nothing)<br />
End Sub<br />
But thanks for your help
|
|
|
|
|
Hi expert
Could u help me ?
How to find File creation date , file modification date in vb.net?
Is any API available in vb.net to find the File creation date, file modification date?
Regards
Rajesh
|
|
|
|
|
You're looking for the FileInfo[^] class.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
Someone knows if it's possible to add a richtextbox as a cell of a datagrid and how to do that?
Else do you have another control I can use instead of datagrid (I just need a grid and I don't care about linking to data)?
Thanks,
Richard.
|
|
|
|
|
Hi There
I am a complete beginner at this so please excuse the dumb question!
I have been hammering away at my first ever program in VB .NET and seem to have got it all sorted out. It's a viewer to go on a disc with photographs for delivery to clients. It displays previews, allows saving of single or multiple images and reads and displays metadata. The code is not very tidy or anything, but in visual studio it works fine.
Unfortunatly my understanding of the jargon involved in all this is non-existent. Therefore i really do not understand how to go from having something working in Visual Studio to something I can put on a disc with an autorun file and some photo folders and get it to work.
I have managed to put the app from the bin folder on a disc with all the other stuff, and it seems to work fine on the machine with Visual Studio on it. It will not, however, work on other machines. On trying to start the app I get a:"Application failed to initialize properly (0x0000135)" message.
What does this mean and how can I fix it.
I would be most grateful if some magnanimous programmer out there could help me out of my shocking ignorance.
Thanks!
Dr. Wizard
|
|
|
|
|
It would appear that the other machines don't have the .NET Framework installed, or at least the version of the Framework that your app is compiled on.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
You'll need to create a release version of the application which saves the CLR(Control Language Runtime) file to disc. This enables other users withour the .NET framework to run the program.I know VB.NET 2003 has a great Wizard for doing this so you might want to check out On-line help as it is a bit long winded to put down here.
|
|
|
|
|
First you have to distribute the .net framework to all computers that the application will work.
And then you have to distribute the components that you use also.
For example:
What component do you use to display the images??
Thats the problem.
|
|
|
|