|
This is usually (in my experience) done in the Page_Load event. Just use an if(!Page.IsPostback) block like stated above.
|
|
|
|
|
Is it possible to add an Underlined letter style shortcut to the buttons of a MessageBox dialog without wrting my own class to do it.
|
|
|
|
|
No
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I didn't think so, but my manager asked me to check.
|
|
|
|
|
Tell him you spent longer checking than it takes to write such a simple dialog, and that makes him an idiot.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
*grin*
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
It'd take me longer than this posting because I don't know how to do the automagic width setting based on the message string. It's an issue for complying with client provided UI standards, although I suspect we'll just br adding it to the waiver list.
|
|
|
|
|
Graphics.MeasureString
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Where/how should I make the call. I tried doing it in the set method for the relevant string, but intelisence won't show the constructor for a Graphics object, and I can't find where to find an existing one for the form.
|
|
|
|
|
Basically you need to create a graphics object for the control, use it to measure the string, and use that to resize the box, probably in the constructor, given that you probably set the string before calling showDialog
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
My problem is that even though I've got system.Drawing added to my using block, intelisence isn't showing what parameters the graphics constructor takes, and for some reason I'm not finding them among the classes methods in the help either.
|
|
|
|
|
There is no constructor, only static FromXXX methods. FromHWD is probably what you need.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks. I've never done anything with the Graphics namespace before, and my experiances trying to do similar in MFC were primarily headbanging sesions.
|
|
|
|
|
|
CreateGraphics() is e mthod available from the Control class. So writing myControl.CreateGraphics whill create the appropriate Graphics object for you. Another hint: Dont forget disposing it when you don't need it anymore:
using (Graphics g = myControl.CreateGraphics()) {
}
|
|
|
|
|
I am new to C# and am doing a project using winforms.
Right now I have all individual forms (say 12 forms) for carrying out each user functionalities with proper navigation. Every thing works well. But now I want create a master form and keep all the 12 form as child forms. How do I do it.
Also even after I close the project I could still see my .exe process still running in the task manager. how do I solve this.
Thanks in advance.
|
|
|
|
|
Ann66 wrote:
But now I want create a master form and keep all the 12 form as child forms. How do I do it.
The form that gets started when you start your app should be the master form. Then it creates the child forms and uses ShowDialog to make them appear.
Ann66 wrote:
Also even after I close the project I could still see my .exe process still running in the task manager. how do I solve this.
For how long ? That just plain should not happen.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi All,
I'm new and trying to get cell values from a datagrid. The grid itself is read only so a double_click event or context menu selection is required on a given row to call an edit form. I can get the row selected easily enough, but can't seem to get to cell values? I thought this would be a simple datagrid1[row,cell] call. Searching the net shows lots of advanced examples using different control types in each cell and doing all sorts of stuff. I don't need to do all sorts of stuff, just a simple selection of the cell values for a given row. I'm missing something thats probably obvious because this is far from complex.
How do I execute this simple functionality?
TIA
|
|
|
|
|
never mind, got it. it was as simple as [row,col]
thanks
|
|
|
|
|
Compiling my code, I got this error:
Error 1 Inconsistent accessibility: parameter type 'Asterisk2.Extension' is less accessible than method 'Asterisk2.ExtensionForm.AddExtension(Asterisk2.Extension)'
in the class ExtensionForm.cs
For thelife of me, I cannot figure this one out.
Any suggestions?
Lilli
|
|
|
|
|
Well, this could happen if you have something like this:
private Extension {...}
public ExtensionForm
{
public AddExtension(Extension myExt) {...}
}
See, if AddExtension is public, then it can be called by anybody. But since it expects an Extension parameter, which is private, nobody can actually call it then except for you. Does that help?
Picture a huge catholic cathedral. In it there's many people, including a gregorian monk choir. You know, those who sing beautifully. Then they start singing, in latin, as they always do: "Ad hominem..."
-Jörgen Sigvardsson
|
|
|
|
|
Yeah, that was my first guess but Extension.cs is public as well. They also share the same namespace.
|
|
|
|
|
Would you mind posting the signatures of all the classes, namespaces, and methods involved? I think it would be helpful to determine the error.
Picture a huge catholic cathedral. In it there's many people, including a gregorian monk choir. You know, those who sing beautifully. Then they start singing, in latin, as they always do: "Ad hominem..."
-Jörgen Sigvardsson
|
|
|
|
|
namespace Asterisk2
{
public partial class ExtensionForm : Form
{
public void AddExtension(Extension e)
{
...
}
}
}
namespace Asterisk2
{
class Extension
{
public Extension(string ext)
{
....
}
}
}
Thanks so much!
Lilli
|
|
|
|