|
Create a single method in your code, and tie the event of each control to that method.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Or, if your adding these controls dynamically, look into AddHandler[^]. Don't forget to lookup it's opposite, RemoveHandler.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi, i have been quite busy lately due to exams at uni, but i would just like to say thanks for your advice....
The following code is exactly what i needed
Add this code and some controls to a form and on each Mouse_Enter of any control the main event is triggered..excellent
'Every control added to the form cause this event to be raised<br />
WithEvents MyDummyControl As Button<br />
Public Event MyEvent() ' Declare an event.<br />
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
Try<br />
Dim mycontrol As Control<br />
'count number of controls<br />
For x As Integer = 0 To Me.Controls.Count - 1<br />
'Associate controls<br />
mycontrol = Me.Controls.Item(x)<br />
' Associate an event handler with an event.<br />
AddHandler mycontrol.MouseEnter, New EventHandler(AddressOf TriggerMyEvent)<br />
Next<br />
RaiseEvent MyEvent() ' Raise an event.<br />
<br />
Catch MyError As Exception<br />
'dont do event<br />
End Try<br />
End Sub<br />
<br />
<br />
Private Sub TriggerMyEvent(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyDummyControl.MouseEnter<br />
<br />
End Sub
Thanks again
|
|
|
|
|
I'm a non-profit organization and I'm trying to develop a remote access desktop application either in VB 6 or VB.NET that will allow remote control of a computer, so that a tech can troubleshoot problems, similar to Netmeeting, allowing the tech to control the mouse, keyboard strokes and see the screen of the remote computer as close to real time as the Internet connection will allow. We have looked into products from other companies, but the repetative costs are too much. Any help would be greatly appreciated. If it can't be done in VB.NET or VB 6, can someone point us in a direction to go to get this done. We refurbish computers for the developmentally disabled and need remote access troubleshooting. We've looked at some of the open GNU product and it's either full of spyware or not in a language we code in currently.
Michael Bragg, President
eSolTec, Inc.
a 501(c)(3) organization
http://www.esoltec.org
|
|
|
|
|
Google around for VNC. You'll find just what you're looking for. I would suggest dropping the VB6 version though and going with VB.NET. Much easier to do with greater flexibility.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
David,
thank you for your tip, however, VNC has spyware in it and it's also written in C++ I believe. I need something in VB6 or .NET so that I'm able to edit it for use in our company.
|
|
|
|
|
As the title,
I know it can be done if using Adobe Acrobat SDK,
and SDK 5.0 is free.
But the Adobe does not provide 5.0 SDK(Win) any more...
Any good idea for the same perpose?
Thank you!
|
|
|
|
|
Do you just want to parse the contents of the PDF document, or do you want to actually render the document on a Form ?
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
In My case, I need to render the document on a form.
|
|
|
|
|
|
It sounds so good, but it is not free.
anyway, Thanks for your advice.
|
|
|
|
|
Oh, I apologize. Free. That makes it more difficult. Many libraries out there exist to create/read/convert PDF documents; however, displaying them requires a lot of work (a lorry's load, depending on how you do it). Because of that, I don't think that we'll find any free libraries to do that. I'm sorry.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
i am trying to write a character that is received from the the serial port to a textbox but the received character never shows up in the textbox. the serialdata received event handler fires and using debug you can step through the code & follow the character as it is written to textbox1.text but it never actually shows or is visible in the textbox on the form. all the serialport setup etc is done in module1 - open(), isopen(), getportnames()etc & write the returned information into textbox1 with no problems.
Public Class Form1
Public Sub MyRxData(ByVal intRxData As Integer)
Dim strAscChar As String
strAscChar = Chr(intRxData)
TextBox1.Text &= strAscChar
End Sub
End Class
Module Module1
Dim WithEvents _Rs232 As New SerialPort()
Public Sub _Rs232_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles _Rs232.DataReceived
If _Rs232.BytesToRead > 0 Then
Do
Form1.MyRxData(_Rs232.ReadByte)
If _Rs232.BytesToRead = 0 Then
Exit Do
End If
Loop
End If
End Sub
End Module
when all the code is lumped into Form1 it all works with no problems, it is only when i put all the serial port code into it's own module that the problem occurs. i have had no formal training in vb etc as i am involved in hardware design, FPGA & micros etc so i suspect i am doing something stupid or doing it in a way that it is not meant to be done, so any help & suggestions would be greatly appreciated. Thanks
|
|
|
|
|
andrewke1 wrote: TextBox1.Text &= strAscChar
Should that be += ? Have you debugged to make sure that strAscXhar is the character you want ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote: Should that be += ?
&= is correct. VB uses the ampersand '&' to append strings.
|
|
|
|
|
I knew that VB6 did, I thought that may have been fixed in VB.NET.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote: I knew that VB6 did, I thought that may have been fixed in VB.NET.
Fixed? You make it sound like it was a bug.
Anyways, I just looked it up and it turns out that VB.NET supports + for string concatenation too.
|
|
|
|
|
thanks for quick reply
using += does not make any difference
i have added a breakpoint at the line "strAscChar = Chr(intRxData)"
if i send a message "H" and step through the program i get intRxData &H48.
after the line is executed strAscChar is "H" - which is correct.
after the final line " TextBox1.Text &= strAscChar" is run and the yellow highlight cursor has moved to End Sub if i hover the mouse cursor over the
"TextBox1.Text" part of that line it shows that "H" has been written, so VS thinks that everything is ok but nothing is visible in the textbox on the form
|
|
|
|
|
A word of advice - if Dave K says anything on the VB forum, ignore anything I might have said. He's obviously spotted the problem, which is apparently that you're not using the actual form that is being displayed.
Dave K is the king of the VB.NET forum, I am but a clown prince
Christian Graus - Microsoft MVP - C++
-- modified at 19:43 Wednesday 11th January, 2006
|
|
|
|
|
Christian Graus wrote: Dave K is the king of the VB.NET forum, I am but a clown prince
Oh come on! I respect you far more than a lowly court jester!
Honestly, I think you're better at this than I am. You've got far more experience than I do in major applications, patterns, and many other things. I put you right up there with Heath.
My primary job isn't development. I'm just a completely self-taught, don't know it all, but know where to look and know how to test, kind of guy. My primary job is keeping the damn place running 24x7. I just write system utils, manangement apps, data collection agents, automation tools, SQL databases to backend 'em, ... [beep] [beep] [beep] Crap! Now what's busted?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote: You've got far more experience than I do in major applications, patterns, and many other things. I put you right up there with Heath
*blush* thanks.
Where you've got me beat is VB. I only answer here because so many people ask framework questions, which I can answer.
Dave Kreskowiak wrote: I'm just a completely self-taught
Me too, it's the way to be IMO, you learn early on to find out stuff for yourself, which is so vital.
Dave Kreskowiak wrote: I just write system utils, manangement apps, data collection agents, automation tools, SQL databases to backend 'em,
LOL - so you write a bit of everything then ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote: LOL - so you write a bit of everything then ?
Nothing bigger than 5 projects in the same solution. It's for an application that can read poker hands, record them and figure odds on-the-fly. Not done yet though... Been way too busy.
Remember that flurry of people trying to figure out how to make click-through forms a while back? A form that when you clicked on it, the click went through the form to the window behind it. I implemented a little solution using an article I found on MSDN. I should be writing an article for it, but, again, that time thing....
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
OK - that sounds like a cool article. I'm still trying to figure out a way around the thing where a child form has it's own child, and the dialog result gets passed all the way to the top level parent.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hmmm... The closest I've even seen is turning a form into a control on another form. But, of course, you'd have to pass the dialog result up the chain yourself. An example of which is in Five Tricks for Your Visual Basic .NET Bag[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
It doesn't show because you're not actually calling the function on the VISIBLE form. One possible cause is you're not passing an instance of the form to the code in the module.
Second, your module code shouldn't be trying to modify anything on the form or even calling a form's methods. It's not good practice and makes for very tightly coupled code. In other words, your module entirely depends on the existance of the form with know methods exposed on it. This is incorrect practice!
This is why the code worked when it was on the form instead of in the module! BTW: Modules, IMHO, are very outdated VB6 constructs. Don't use them if you don't have to.
Rewrite this into a class that exposes an event. This event can return that character to any class, form, or whatever, that subscribes to the event. Let the form decide which control, if any, is going to show this data.
You might want to read Raising Events and Responding to Events[^] on MSDN.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|