|
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
|
|
|
|
|
thanks for all the help & advice
looks like i have plenty of learning to do
i will try to rewrite it into a class and see how i go
|
|
|
|
|
Thees a function which takes the name of a 1d array calVolume() like so
CWGraphVolume.ChartY calVolume
However now I have a 2d array calSignals(0 to 1, 0 to numSamples - 1) and want to send in the 2 arrays separately
I tried:
For num = 0 To 1
CWGraph1(num).ChartY calSignals(num,0), TimePeriod / numSamps
Next num
but its not plotting correctly. How do I pass in the two 1-d arrays?
thanks,
sb
|
|
|
|
|
If the function was written to take a single dimension array, that exactly what you have to pass to it. You can't cheat it and pass a 2 dimension array, unless the function code knows how to handle it. I doubt this is the case.
Sooooo.... You have to create a 1 dimensional array and pass that instead.
Dim newArray() As whateverType
For num = 0 to 1
ReDim newArray(0 To UBound(calSignals, 2))
For x = 0 to UBound(calSignals, 2)
newArray(x) = calSignals(num, x)
Next
Next
CWGraph1(num).ChartY ...
Do you really have an array of these objects created?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-- modified at 15:55 Wednesday 11th January, 2006
|
|
|
|
|
Hi Dave,
I used your snippet , thanks so much. It worked great, appreciate the help,
sb
|
|
|
|
|
Does anybody know how to detect that an app is being killing??
some games, like command & conquers show you a dialog to close when you try to kill from process list.
is there a windows message (other than WM_CLOSE) that can tell me that my app is being killing???
modif: am using VB6
--------------------------
there's another hope...
-- modified at 15:28 Wednesday 11th January, 2006
|
|
|
|
|
If you're talking about a VB.NET WinForm app, then you need to handle the form's "Closing" event.
If this is a VB6 app, then you need to catch the "Form_QueryUnload" event.
-- modified at 14:12 Wednesday 11th January, 2006
|
|
|
|
|
am using VB6, but without form events, is there a way to detect a process killing, to show a dialog or execute code??
i see this in some games, i wonder how the program do not terminate but show a dialog asking you to confirm program exit.
|
|
|
|
|
edwin164 wrote: i see this in some games, i wonder how the program do not terminate but show a dialog asking you to confirm program exit.
I would expect a game to make calls to PeekMessage() within the game loop. It would need to do this to receive keyboard and mouse input. It would also catch the window's WM_CLOSE and maybe the WM_QUIT events as well, allowing the game to close itself gracefully.
You need the window's handle in order to receive its messages. Once you receive the WM_CLOSE message, you can display your confirmation dialog. You would call DestroyWindow(hWnd) to close it afterwards, if you're doing it via Win32 API.
|
|
|
|
|
edwin164 wrote:
is there a windows message (other than WM_CLOSE) that can tell me that my app is being killing???
AFAIK that's the only WM message. In the beginning the OS tries to close it in a polite way sending that message.
Still you don't need to intercept the message since the framework provides you with a pre-built event for each form (Closing). That event allows you to cancel the closing with the Cancel argument.
If the form is mandatory closed by an external event (OS) again the FW should give you the event Closed.
|
|
|
|
|
am using VB6 so no framework is available...
i wondering how some apps (probably not written in VB) can intercept a process killing. not using forms event is there another way to execute code before process die??
|
|
|
|