|
You're welcome.
I realize it's nicer to get a helping hand than a slap in the face.
You always pass failure on the way to success.
|
|
|
|
|
We have a program that I do not have access to the code. What I would like to do is create my own program that can be initiated when a specific button click event occurs in the parent program. How could I make this happen if it is even possible. Also what tool can I use to find the specific event name for that button click when it occurs so I can make it happen?
TIA,
Brian
|
|
|
|
|
Process.Start
Oh, I see. If you don't have the parent program source, you can't do it.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Have you considered not going through the parent program instead creating a whole new app that opens the parent using a totally transparent form and just making it look likt the buttons are part of the parent but really being contoled by yours
|
|
|
|
|
|
Nick Alexeev wrote: Have things changed significantly since that time? Well, VB6 haven’t changed of course.
No, it hasn't. It's just that the world has moved on to VB.NET and the XML classes built into the .NET Framework. Seriously, new tutorials for VB6 are very hard to come by.
|
|
|
|
|
Is there any way to tell the system that a certain exception is sufficiently "expected" that I don't want it to be reported in the debug/immediate window? I know that ideally code would avoid causing exceptions in the first place, but that isn't always possible. For example, if I want to write a 'terminal' program that can operate using either a serial port or a socket, I need to find out if there's any data available to be read; the only way I know to do that is to try the read and see if it works. If it doesn't, it will throw a system.TimeOutException. Reporting that zero bytes were received when that happens works, but the debug/immediate window gets so flooded with first-chance exception messages as to be otherwise useless.
If I wanted to code the reader to explicitly expect certain types of streams (e.g. TCP socket or serial port) I could explicitly use the data-ready functions for those, but that would defeat the purpose of object-oriented programming.
|
|
|
|
|
Maybe I am not understanding you 100%, but it sounds like you are looking for a try-catch block:
<br />
Try<br />
<br />
Catch ex As Exception<br />
<br />
End Try<br />
Pete Soheil
DigiOz Multimedia
http://www.digioz.com
|
|
|
|
|
I have a try-catch block:
Try
n = stream.Read(b, 0, 1024)
If n Then
Broadcast(2, b, n)
End If
Catch ex As TimeoutException
n = 0
End Try
The code works, but my debug/immediate window is flooded with thousands of
A first chance exception of type 'System.TimeoutException' occurred in System.dll
Makes the debug/immediate window useless for anything else.
|
|
|
|
|
Have a look at the menu Debug/Exceptions...
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
The Debug/Exceptions menu lets one specify whether exceptions should cause a program to stop in the debugger, and whether such behavior should occur even when a user exception handler exists. I don't see anything in there to control the diagnostic messages, though. They print even if the timeout exception is disabled in the Debug/Exceptions menu.
|
|
|
|
|
Well that's too bad. I am using C# and have some timeouts in my code, mainly for dealing
with exceptional cases tho. Can't you cut it with the Socket.Available property
and the SerialPort.BytesToRead property or the SerialPort.DataReceived event?
Seems to me you could read the property, and if insufficient data is present, do
Thread.Sleep(delay), then read the property again. (For bigger delays you might choose
to do more property reading).
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I finally decided that since my goal is (as noted in a different reply) to simply get something that works, I'll put up with the ugliness of explicitly checking within my polling handler to see what sort of stream I'm dealing with and handle the different types explicitly. I don't like doing that, and it somewhat defeats the purpose of object-oriented programming, but given that the program is for test purposes anyway, it's better to get the thing done quick-and-dirty than spend too long worrying about how to do it cleanly.
|
|
|
|
|
Hi,
you could define an interface with a DataAvailable property and a Read method,
then encapsulate each of your data sources in a class that implements that interface, and
finally have your data consumer simply call the interface members; doing so would
keep the consumer unaware of the uglyness of (some) data sources, as OO would require.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
There's no way to suppress those messages. It sounds like your code is generating, and relying on, those thousands of exceptions. I would probably reconsider the design of whatever is generating all these exceptions.
For example, if your design is relying on polling (like your code example suggests), you may want to scrap it and rewrite it in an asynch setup.
|
|
|
|
|
Certainly polling is less than ideal in many production situations, since it can lead to excessive CPU utilization. On the other hand, it can also provide a quick and easy way to make things work, especially in test environments (I'm working on a DSP system, and just trying to write PC-side software to monitor and debug the DSP). I've already spent more time trying to learn VB.Net than I would have liked; though such knowledge will certainly be useful in future, it doesn't help my DSP project which is already behind where I want it to be.
|
|
|
|
|
I am working on a project that pulls SQL Server data and places it into a MS Access database. The dataset contains 3438 rows, and 0 rows are inserted into Access. There are no errors when the code run, just nothing happens. The code is listed below:
Public Function InsertAccessData(ByVal dsTDO_Header as dataset) As String
Dim cn As New OleDbConnection(strACCDBConn)
Dim strSQL As String = ""
Dim DA As New OleDbDataAdapter
strSQL = "Select * from TDO_HEADER"
DA.SelectCommand = New OleDbCommand(strSQL, cn)
DA.FillSchema(dsTDO_Header, SchemaType.Source, "TDO_Header")
Dim oleCB As New OleDbCommandBuilder(DA)
Try
cn.Open()
oleCB.GetInsertCommand()
DA.Update(dsTDO_Header, "TDO_Header")
''dsTDO_Header contains 3438 records,
''DA.Update inserts 0 Records in db with no errors
''that is the problem
cn.Close()
cn.Dispose()
DA.Dispose()
Catch ex As Exception
Dim strErrMess As String
strErrMess = "Something didn't work right we received this update error: " & ex.Message
cn.Close()
cn.Dispose()
DA.Dispose()
Return strErrMess
Exit Function
End Try
Return "Success"
End Function
Can anyone see where I went astray?
Thanks in advance for any help.
culbysl
|
|
|
|
|
First, this is a bad way to do this.
Second, the DataAdapter is looking at the status of each row in each table in your source dataset that you pass in and not seeing rows that are tagged changed, added, or deleted. So, yes, the DA is doing nothing, because it hasn't found anything to do! It doesn't know that these rows need to be added to the Access database, because it doesn't know anything about the Access database. It's looking solely at the rows you passed in the dataset.
I would recommend reading up on the documentation for any of the DataAdapters to understand HOW and WHY they work the way they do.
|
|
|
|
|
Thanks for getting back to me. I'm get started learning more about dataadapters. As for your first statement, could you recommend another way of doing this?
Thanks again
|
|
|
|
|
Try using the insert command instead update... you need to creat the some odd thousands of records not update 0
|
|
|
|
|
Hello,
I have a question that...the more i try and research online the more confused I get.
What is the difference between typed and untyped datasets.
What I understand is that typed datasets inherit schema information and untyped dont. It seems like there has to be more to it then that.
Erica
|
|
|
|
|
|
I want to make a 'wall' (picturebox) that the cursor cannot pass through.
This snippet that does NOT work. This is about all i got so far. Mouseposition is a read only so this code can't work.
If Me.MousePosition.X > Me.rightwall.Left Then
Me.MousePosition.X = Me.rightwall
End If
|
|
|
|
|
Me.MousePosition is a Point, and Points are immutable, you can't change them, but you
can replace them by a new Point.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hey guys,
I am trying to create a simple program that will graph a polynomial function.
I have followed a tutorial at about.com, and I ran into a problem while programming. Here is the program so far. I left out the designer generated code. There are two textboxes where the user inputs coefficients for the polynomial, a button that the user presses to draw the graph, and a panel where the graph is drawn. I get an error underlining the New Point under the Button1 Click event that says:
Value of type System.Drawing.Point cannot be converted to System.Drawing.PointF
===========================================================================
Imports System.Drawing.Drawing2D
Imports System.Math
Public Class Form5
Inherits System.Windows.Forms.Form
Dim PolyPoints(100) As PointF
Dim Counter As Integer
Dim P As Pen = New Pen(Color.Crimson, 3)
Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
e.Graphics.DrawCurve(P, PolyPoints)
MyBase.OnPaint(e)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim G As Integer
Dim H As Integer
G = TextBox1.Text
H = TextBox1.Text
For Counter = 0 To 99
PolyPoints(Counter) = New Point(Counter, G * ((Counter) ^ 2) + H * ((Counter) ^ 3))
Next
Panel1.Refresh()
End Sub
End Class
============================================================================
I am a novice programmer, and this seems to be a very simple problem. Thanks for your help in advance
Sincerely,
B.T.
|
|
|
|