|
actually i have a main form which calls the input form as modal. there is OK and cancel button on the input form. if the user presses cancel the form closes. if the user presses OK the software checks if all the inputs are correct. in the main form i am using the dialogresult property of the input form. i have set ok as dialogresult of the OK button. so irrespective ofthe validity of the inputs the input form returns the dislog result.
this is why i was trying to exit the buttonOk_click event if the inputs were not valid.
|
|
|
|
|
This can be solved very easily, without having to fiddle with button event handlers.
In your button event handler you could do something like this:
private void OKButton_Click(object sender, EventArgs e)
{
bool inputsOk = true;
if ( !inputsOk )
this.DialogResult = DialogResult.None;
else
{
this.DialogResult = DialogResult.Ok;
this.Close();
}
} That way the Dialog will stay open unless all inputs are valid.
mav
|
|
|
|
|
i had tried te same thing but it does not work.
in the ok button property i have set the dialog result property as none.
i have to press the OK button twice to assign the dialog result property to the button
|
|
|
|
|
Then you must have some other errors in your code.
The DialogResult property of your Button just determines the value of your Form 's DialogResult property when the button is pressed.
At the end of your button event handler, the dialog is closed if the Form 's DialogResult property is not DialogResult.None , simple as that.
If you don't want the dialog to close you have to set it's DialogResult to DialogResult.None .
So in my example, the call to this.Close(); is superfluous, but I wanted to show you where the dialog gets closed.
mav
|
|
|
|
|
Sorry my bad ... I think mav.northwind has provided the ideal example although there are ways to do it this example is ideal ... i didnt read it before i wrote the reply
Pushkar Pathak
|
|
|
|
|
U can overcome this by many ways
firstly make checks in the main form after the dialog result returned OK and if the validity check fails showdialog the input form again
otherwise to keep the main form free from the validity check mechanism
check in the button click event ... since a modal dialog is not destroyed until disposed raise a flag that says "Wrong INput" and let main form check this flag and show the main form again .....
or set the dialog result for the form and the button to none and set the dialogresult for the form in the event if the check is alright so that clicking the button doesnt close the form but u do programitically when reqd and that the main for sees only the dialog result for the form .. take a look at this
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskretrievingdialoginformation.asp[^]
Pushkar Pathak
|
|
|
|
|
Let's have a look at http://www.alachisoft.com/overview.htm [^]
This is a .NET code generator used for developing COM+ architechture.
Tier Developer uses it's own project have extension named *.tdvp. This file type can be understood by .NET and they work well with each other.
My question is: how to do this? How to write an aplication that can be embed to .NET environment?
|
|
|
|
|
|
Hello dear all
i am some bit problem that i wnat to delete mutirow in datagrid how i can delete it. i have search more it there is not one property in datagrid please help me
Priyank Gupta
|
|
|
|
|
A datagrid has a datasource, you must delete rows from there.
|
|
|
|
|
yes i know that but first i want know thata how many row select in datagrid
please tell me how do ou find that how many row select in datagrid there is nay propert that we can find it Please help me
thanks for reply
Priyank Gupta
|
|
|
|
|
I'm trying to do logarithmic curve fitting to plotted data points.
The equation is as follows:
y = a + b*ln(x)
The problem is that I have no clue how to compute the 'a' and 'b' coefficients.
Can anyone think back to scientific comp to remember how this is done?
Thanks
|
|
|
|
|
let u=ln(x)
then y = a + b*u
now use the method of least squares to find a and b.
Note: you are using the method of least squares to find y(u), so everywhere you would use x in least squares now use u(=ln(x)).
There are several good resources on the web. Google for 'Least squares' and 'logarithm'.
-Sean
----
Shag a Lizard
|
|
|
|
|
Hi, I'm working on a syntax-coloring textbox that inherits the RTB control and I have an annoying problem. Since I'm using Select method / SelectionColor property to highlight syntax, I must always store the current cursor position in a variable and then restore it by calling the Select method like this: this.Select(CursorPosition, 0). However, a problem occurs when contents of the textbox spread over more than one page. Namely, the call I use always causes the control to redraw in such manner that the line where CursorPosition is located becomes the first line of the visible area of the textbox, effectively shifting the visible area of the textbox a number of rows down. For example:
Pic 1
Pic 2
It is very disorienting, but I have no idea how to stop it from occuring. Is there some API call or something that can position the cursor within the control without causing this stupid change of focus? If anyone can offer me a way around the problem I will be most grateful.
|
|
|
|
|
How could I change the data source of a dataGrid in run time (Windows Forms)?
datagrid.Update()
What I am trying to do is, to change the data source of the data grid with respect to CustomerID..
If customerID is changed, than the dataView will retrieve the data from DataSet table and then update the datagrid ,without changing data source , update data source with DataView But I couldnt find the method, please guide me to achieve.
Is it possible ?
Thanks ,
Bahadir Cambel
|
|
|
|
|
Hi,
Why to change the datasource? Instead that we can associate the Dataview to the datagrid. Filter the DataSet into Dataview using RowFilter and RowStateFilter properties of Dataview.
Dataview.RowFilter = "customerID=xxxx";
Thanks
SGS
|
|
|
|
|
thanks for the reply ,
but my problem is to update the datagrid.
I can not update the dataGrid when I change the dataView.
To be more specific
I have a curreny manager which is holding the information about the customers named cm
I have 2 dataTables dt_Orders and dt_Customers for orders and customers
I inserted the update operation into ShowCurrentRecord which is called when CurrenyManager_PositionChanged event..
<code>
private void cm_PositionChanged(object sender, EventArgs e)
{
ShowCurrentRecord();
}
private void ShowCurrentRecord()
{
string CustomerID=ds_Customers.Tables["dt_Customers"].Rows[cm.Position]["CustomerID"].ToString();
for(int i =0 ;i <RowCount ;i++)
{
<p>if ( ds_Customers.Tables["dt_Orders"].Rows[i]["CustomerID"].ToString()==CustomerID )
{<p>myDataView.RowFilter="CustomerID="+CustomerID;</p>
</code>
It turned out to be , I can not set anything into RowFilter..
even if I tried dv.RowFilter="CustomerID"+CustomerID;
dv.AllowEdit();
dv.BeginInit();
When I use Watch the find the value , although CustomerID has its value , watch always shows RowFilter as null string..
Does dataView can be edited in run-time ?
|
|
|
|
|
Hahahah , the whole problem was myDataView.RowFilter = "CustomerID= '"+CustomerID+"'"; : )
|
|
|
|
|
Ok. Guess your problem is solved now
|
|
|
|
|
Has anybody come up with a to display "appointments" on a calander similar to how Outlook does it?
In particular, how to display the overlapping appointments the way Outlook does.
If anybody would like to share their ideas, I would be much obliged. I have been trying to come up with ways on my own with no success.
Thank you,
Eric
|
|
|
|
|
i am working on a project of erp in c# so i want how to costumize a print doc in c# at run time
i also want to chang
a position of feild defined in the print doc at run time
Dipesh Patel
|
|
|
|
|
Hey there!
Theres one more thing I have to bug you guys with.
ATM, I am exporting my Bitmap object to a JPEG file, which works quite well.
But I would like to have that Bitmap object/JPEG file appearing on an excelsheet ... exporting a datagrid to a specific sheet already works, so I only need to know the command for exporting the image ...
Any help greatly appreciated!
zaubara
|
|
|
|
|
Noone?
Do you know a place where I could try my luck? ...
Thanks.
|
|
|
|
|
hi,
i have a htmldocument object with what i access the internet explorers document object model. now i want to show some help windows, e.g. like all these tooltip windows, inside the active html document. can anyone of you out there give me some keywords or helpful code samples for this problem?
thanks for help.
|
|
|
|
|