|
cheers both for your helpful responses. i will soon be getting more into PIC development, and i have a PIC programmer coming soon, so i may be able to figure out UART if i need it.
thanks for now,
surgeproof.
-------------------------------------------------------
ithium is the best.
'Science without religion is lame, religion without science is blind.' --Albert Einstein
'The pioneers of a warless world are the youth who refuse military service.' --Albert Einstein
|
|
|
|
|
Hello,
If I want to manage all unhandled exceptions myself, do I have to subscribe to both the AppDomain.CurrentDomain.UnhandledException and Application.ThreadException events or would it be enough to just subscribe to the Application.ThreadException event?
Does the Application.ThreadException event handle all unhandled exceptions or does the UnhandledException event of the CurrentDomain handle some?
Thanx for the clarification
-Flack
|
|
|
|
|
They both allow you to handle unhandled exceptions, but handling the Application.ThreadException gives you a good chance to make sure your application remains stable. Unhandled exceptions that affect the message pump are potentially dangerous. For example, unhandled exceptions in certain places (like when a form is loading) will cause the 'X' button in your window to stop responding, along with others errors you might not notice right away.
Of course, if you're not using Windows Forms (say, a Console application) then handle the AppDomain.UnhandledException event.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello,
I cannot figure out where this problem comes from, so I'm looking for suggestions. In my windows app I have multiple MDIs open as well as a panel on the MDI Parent. This panel contains buttons that get disabled ( btn01.Enable = false; ) programmatically when another button is clicked.
I can reproduce this every time:
1. The buttons and labels on this "parent" panel are enabled and populated respectively from the OnMDIChildActivate() event.
2. When a button is clicked, another button is disabled. Due to that last event the active MDI child changes to the first one opened rather than to continue with the code in the function being processed (the onClick event handler).
Note: There is no event handler for the "disable button" event.
Note: The OnMDIChildActivate() event takes a DataSet from the MDI Child which it uses to populate the panel.
Any suggestions?
Thanks,
Remus
|
|
|
|
|
Hi,
A couple fo questions -
+ Is the button that is being disabled on the active form or another form?
+ Also you say the code jumps out of the OnClick handler, did you mean focus only but code executes fine.
You might have to take the long way - write a diable event that returns focus to the 'current' mdi form window.
|
|
|
|
|
Hello,
"+ Is the button that is being disabled on the active form or another form?"
A: The button is found on the same panel in the MDIParent as the button that is being clicked when it is disabled.
"+ Also you say the code jumps out of the onclick handler, did you mean focus only but code executes fine."
A: The code after the ( Button.Enable = false; ) line is not executed - I found out through MessageBox.Show() that it is the last line executed, after which the focus shifts to another form and the OnMDIChildActivate() code is executed. And, I might add, there is plenty of code after that last line...
I'm thinking that to find the 'current' mdi form window may take lots of work for every button event and such. I'm thinking more along the lines of having to create a custom button out of images as it doesn't seem to have the "jumping focus" for anything but the buttons.
More suggestions are welcome - and no matter what I do for a solution, I would still like to find an explanation...
Remus
|
|
|
|
|
I've not been able to trap this event in my WndProc override on my form. I did a search for this problem on this message board and saw two similar responses, anybody know anything about this ?
|
|
|
|
|
The WM_NCLBUTTONUP message is only generated on the extreme edge of a client window.
You could try using the WM_LBUTTONUP message instead and checking to see if the mouse position is outside the client area to get the same effect.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
It appears that the WM_LBUTTONUP or WM_LBUTTONDOWN messages are not generated until you click in the client area of the form. In other words if I launch my Form and the first place I click is in the control bar (Nonclient Area) at the top of the Form no messages are raised. However, if I click in the Client area first, then the messages are raised no matter where the click event occurs....
Any other ideas ?
I tried this.Focus() in my Form_Load handle, just incase the Form needed to have focus first, but same results.
|
|
|
|
|
I don't have any other ideas...
This appears to be something that Microsoft screwed up the documentation on.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi all,
I have a ColumnChanging event attached to a dataset to perform validations. For some reason unknown to me, the event does not get fired when the user presses the 'tab' key with a null cell.
I am trying to make sure that no cell is null. When no value is entered in a cell, and the column is changed, I want the ColumnChanging event to capture it and throw a messagebox to the user. Please help.
Here is what I have -->
private void Division_ColumnChanging(object sender, System.Data.DataColumnChangeEventArgs e)
{
...
..
.
if ( (e.Column.ColumnName.Equals("Div_Code")) ||
(e.Column.ColumnName.Equals("Div_Name")) )
{
if(e.ProposedValue.ToString().Length == 0)
{
MessageBox.Show("Column " + cs.HeaderText + " cannot be null.", "SPIRIT2 - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
dataGrid1.CurrentCell = (DataGridCell) sender;
}
}
...
..
.
}
|
|
|
|
|
Hi,
Typically in the empty column of a table, the value "(null)" is entered by default(for a data grid atleast) and that is probably why the null case is not being detected. You will probably need to put in a break point to see if the value being returned is indeeed "NULL" instead of "" like you expect. I haven't tested this myslef so I could be way off.
Hope this helps.
|
|
|
|
|
i have a project all developed with technology smartclient(webservices).Need to know as I make to know in the machine customer the application he is being had access through a LAN(Intranet) for example or is being had access the application saw WAN(Internet) it are of the LAn?
|
|
|
|
|
I really couldn't make heads or tails of what you wrote. I'm guessing that you want to know if your WebService can determine if a call came from the local network or Intranet (inside a corporate network) or from out the corporate network?
The short answer is no. The only thing you could do is take the IP address of the request and mask it with the WebServer's subnet mask and compare it to the network address of the WebServer. This will only tell you in the request came from the EXACT SAME SUBNET as the WebServer, otherwise, it's a request that came from over a router and is considered over the WAN.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Here is my question.
Not sure how to ask this really.
I have had very bad luck passing values between forms.
If I open a form and pass a value that works fine. But If I have to pass
some values back to a "Parent" form it does not work so well.
The only way that I have found to do this is using the registry.
Write values to the registry then from the parent window close the form
and read the values that were set.
Is there a better way to return a value from a form?
Thanks
Will
|
|
|
|
|
You can use public members as a starting point.
public class MyForm : Form
{
public int MyTestInt;
}
public int MyMethodInAnotherForm()
{
int returnValue = 0;
MyForm dlg = new MyForm();
dlg.MyTestInt = 0;
if (dlg.ShowDialog() == DialogResult.Ok)
{
returnValue = dlg.MyTestInt;
}
dlg.Dispose();
return returnValue;
}
|
|
|
|
|
Thank you for the reply.
I think I asked this wrong..
I have a Main Form lets call it FormMain.
On this form is a TextBox where a user will enter in a Part Number
Now I have to look for the Part Number. If I can not find an exact match I can
A) Display a list of Part Numbers that are close
B) Allow the user to enter a New Part Number
In order to do this I open another Form.. Lets call it FormPart
Now On FormPart lets say that the user decides to add this New Part, so they input
the Description.. and other information. Now the Stored Procedure that I use to enter the
New Part in the database returns the ID Number for that Part. I need to send this ID back to FormMain and continue processing. It is really easy to send a value to a form, It is also easy to return a value if there is no end user interaction. But because of the type of application, I have to allow the user to either Select an Existing part or enter a new Part.
Again thank you for the answer
Hopefuly I have described my problem better this time. If I can find a solution I will post it. But from where I am looking, the registry looks like the best place for temp storage of this ID
Will
|
|
|
|
|
Will,
You are thinking to hard and missing the simple solution. I have coded hundreds of dialogs that process similar logic.
Just because your second form processes data does not mean it can't store the result (PartID) in a public member variable for the other form to pick up. If you are using Modal dialogs (ShowDialog()) then the example template I gave you will work well.
If you are using Modeless dialogs, then the second dialog needs to call back to the first (simply pass a reference to the first form in the constructor).
Think of the question you are asking FormPart: "What is the PartId the user has chosen?"
It doesn't matter to the first form if the part was just created or has been in the database for a century. The first form just needs a valid PartId. Have FormPart do whatever processing it needs to do and store the resultant PartId in a public member variable.
If you are still having trouble, I would be happy to trade a few samples with you until you get the idea. Using the registry is a very sloppy way of handling data transfer within an single process. I would hate to see you continue on that path.
You can contact me directly at mdpotter55@yahoo.com
|
|
|
|
|
The simplest way is to pass a reference of the first form to the second form, either by passing it to the other form's constructor or assigning it to a property. Don't just use Form , though. Declare the type of the parameter or property the actual type of your form so that you can easily access public or internal members.
Typically, though, it's easy to "return" a value. For instance, you could declare a property that can get (or optionally set) the part name for which similar part names should be found. When that form returns, get the value (which the popup form sets):
private void someButton_Click(object sender, EventArgs e)
{
using (PopupForm form = new PopupForm())
{
form.PartName = "asdf";
form.ShowDialog(this);
someTextBox.Text = form.PartName;
}
} Using this approach allows you to reuse that popup form from other forms when you need it.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Is there an event that lets you know when a new row is being added to a datatable edited in datagrid? There is an event for RowDeleting. Any way to know when a row is being added?
|
|
|
|
|
It's actually on the DataTable class, along with several other events. The DataGrid is implemented abstractly, working with any data source that implements IList or IListSource . Anything specific to how that data is manipulated would be specific to the data source. In this case, all the events you'd need for knowing when a row was inserted, changed, or deleted are defined on the DataTable class. See the class member documentation in the .NET Framework SDK for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
As far as I can see there is no event for when a row is inserted. If there is can you tell me what the event is called. anybody?
|
|
|
|
|
Handle DataTable.RowChanging or DataTable.RowChanged (whichever is appropriate). The DataRowChangeEventArgs.Action specifies whether a DataRow is being added, changed, committed, deleted, or rollbacked.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
It is possible to lock the Excel process my app creates at runtime so that if the PC user opens another Excel file it does not get opened into 'my' excel process?
Would this be an Excel thing that I can control?
|
|
|
|
|
There is no way to "lock" the Excel process.
You can't really handle the WorkbookLoad event either, because that event fires AFTER the new workbook is loaded...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|