|
Hi,
I have a modal dialog that I don't want the user to close via the close button, how do I disable it?
Thanks
|
|
|
|
|
Override the OnClosing event and set the Cancel memeber of that event argument to true. Rember that just disabling close button won't do the job, user can still use ALT + F4 .
Stevo
|
|
|
|
|
wow, all that effort :/ in swing I remember just having to set a field :/
Thanks 
|
|
|
|
|
He you can do it by 2 methods,
First one is just capture closing event of that form and make
e.cancel = true;
or second method is you disable closing button using following code,
You have to use win32 dll.
<br />
const int SC_CLOSE = 0xF060;<br />
const int MF_BYCOMMAND = 0x0;<br />
<br />
[System.Runtime.InteropServices.DllImport("user32.dll")]<br />
public static extern IntPtr RemoveMenu(IntPtr menuHwnd, int position, int flags );<br />
<br />
[System.Runtime.InteropServices.DllImport("user32.dll")]<br />
public static extern IntPtr GetSystemMenu(IntPtr hwnd, int bRevert);<br />
<br />
public static void EnableApplicationClose( System.Windows.Forms.Form form, bool val )<br />
{<br />
IntPtr menu = GetSystemMenu( form.Handle, val ? 1 : 0 );<br />
if ( !val && menu != IntPtr.Zero )<br />
RemoveMenu(menu, SC_CLOSE, MF_BYCOMMAND );<br />
else<br />
{<br />
form.Enabled = false;<br />
form.Enabled = true;<br />
}<br />
}<br />
<br />
Rahul Kulkarni
|
|
|
|
|
I think I'll opt for method 1 
|
|
|
|
|
Choose a window style without close button: FormBorderStyle.None
Having a button (or any GUI element) visible but turned off (without a visual clue)
is not good practice.
|
|
|
|
|
Luc Pattyn wrote: Having a button (or any GUI element) visible but turned off (without a visual clue)
is not good practice.
Yup! The entity that can not be used drives the user mad.
|
|
|
|
|
and the dialog that can't be closed drives the user to kill process and uninstall.
--
You have to explain to them [VB coders] what you mean by "typed". their first response is likely to be something like, "Of course my code is typed. Do you think i magically project it onto the screen with the power of my mind?" --- John Simmons / outlaw programmer
|
|
|
|
|
I need to download data from multiple web servers using a web-service. Now the same web-service will be running on each of the servers. They will just have separate URL.
I am a new-comer in this web-service technology. I can only implement clients by first adding web reference to one of the servers. Developing clients without adding web reference seemed very complicated to me. So i want to add one reference and change the URL to access other servers.
Now my question is-
I will write the client code by adding any dummy web-server as web-reference. Then later when my client will run, this web-server might be shut-down, but it will keep calling this web-service by using other URL's. Will this create any trouble?
thanks
Chayan
|
|
|
|
|
If you check out the client applications config file, there should already be a webreference url entry. Before deploying the applicaiton to the client, cant you just change this entry to the right URL?
Unless I understood your query wrong
|
|
|
|
|
Hi,
When i use this NVC.GetValues(KeyName), at times i am getting the following
error,
Void Copy(System.Array, Int32, System.Array, Int32, Int32, Boolean) :
Source array was not long enough. Check srcIndex and length, and the array's
lower bounds.
and
i am getting NullReferenceException when i use NVC.AllKeys with the
following message,
System.String BaseGetKey(Int32) ~ NRE ~ Object reference not set to an
instance of an object.
I cant predict the reason.
Here is my code snippet,
public void ProcessData(MyNVC procNVC)
{
if (procNVC.Count > 0)
{
try
{
string[] KeyArray = procNVC.AllKeys;
foreach (string skey in KeyArray)
{
string[] sVals = procNVC.GetValues(skey);
if (sVals.Length > 0)
{
sbuild.Append(skey + procNVC.Sum(sVals) + ';');
}
}
}
catch (ArgumentException oARG)
{
log.Info(oARG.TargetSite + " ~ ARG ~ " + oARG.Message);
}
catch (NullReferenceException oNRE)
{
log.Info(oNRE.TargetSite.ToString() + " ~ NRE ~ " + oNRE.Message);
}
catch (Exception oEXcpn)
{
log.Info(oEXcpn.StackTrace + " ~ EXCPn ~ " + oEXcpn.Message);
}
if (sbuild.Length > 0)
{
SendToClient(sbuild.ToString());
sbuild.Remove(0, sbuild.Length);
}
}
else
log.Info("No Elements in Collection:" );
}
With Thanks and Regards
Sakthi.
|
|
|
|
|
I need some help on getting the intellisense to work in the editor for my custom control.
I have a control had uses sup elements. Look like this.
< Control >
< / Control >
I can't get the design time support working for the option elements like it works in the datagrid and other controls. I they have it I can have it too. So if anyone knows something about this. Please help me.
|
|
|
|
|
hi,
filled my datagrid,but i want to retrieve the contents a selected row and have them displayed in the text boxes for editing...and bla bla.Cab some one help me wit that?
cheers
The nature of your experience depends on your point of view.
|
|
|
|
|
use the datagridrow editing function add the edit/cancel button on the datagrid and start over...
I was born dumb!!
 Programming made me laugh  !!!
--sid--
|
|
|
|
|
Hi,thanks for the quick response
Am using windows forms no ASP.NET.
to load the current row selected in the datagridview
int CustomerID = int.Parse(dataGridView1[dataGridView1.CurrentCellAddress.Y, 0].ToString());
customer customer = customerManager.GetCustomer(customerID);
then i fill the respective textboxes with data from that cell
txtcustomerID.Text = customer.CustomerID.ToString();
txtname.Text = customer.CompanyName;
the GetCustomer() method's definition is
public static customer GetCustomer(System.Int32 CustomerID)
{
string ConnectionString = "Server = (local);Integrated Security = SSPI ;Initial Catalog = pos";
string query = "Select * from CompanyProfile where CustomerId " + CustomerID;
DataTable dt = DataManager.ExecuteQuery(ConnectionString, query, "customer");
if (dt.Rows.Count == 0)
{
return null;
}
return new customer(dt.Rows[0]);
}
But when i run the Program and click in one of the cells,I get an error saying Input string is not in the correct format.
and the customerID value is 0 in that case though the value in the Database is 1.
The nature of your experience depends on your point of view.
|
|
|
|
|
What i want to do is,Get the value of the first cell with index 0 of the column CustomerID and use it in the query
which is "select * from companyprofile where customerID " +CustomerID;
-- modified at 4:58 Monday 2nd July, 2007
-- modified at 5:01 Monday 2nd July, 2007
The nature of your experience depends on your point of view.
|
|
|
|
|
I am getting a bunch of values via serial at baud 115200, now the values are like 5000 bytes at one paste on the hyperterminal. I am usign string to take it in. using the break point set on the input, it works fine, but whenI remove the break point it give a range our of bounds error....the following is the code. Help
string mine = "";
mine += sp.ReadExisting();
sp is the serial port.
Thanks
|
|
|
|
|
how do I call a delay of maybe 1 second with C#, is there any library to do this?
|
|
|
|
|
Hello,
You could work with timers. (System.Windows.Forms.Timer)
Or use Thread.Sleep(1000)
All the best,
Martin
|
|
|
|
|
|
Hi,
How can you find the process that called a particular function?
I've set a breakpoint on a function that gets called twice but should only be called once. I don't really want to step through the whole program so how do I know what executed immediately prior to the breakpoint?
Glen Harvy
|
|
|
|
|
Glen Harvy wrote: how do I know what executed immediately prior to the breakpoint?
That's what the Call Stack window in VS is there for. Place a breakpoint in your method and then bring up the Call Stack window (you will find it in the lower right of the VS window when you're debugging) - it will show you everything from Main().
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
For 18 months I've never used it - thanks
Learn something new *every* day.
Glen Harvy
|
|
|
|
|
Strg+Alt+C activates what have been suggested before!
All the best,
Martin
|
|
|
|
|
Martin# wrote: Strg
Is that German for Ctrl?
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|