|
Could you please show some example for my better understanding.
|
|
|
|
|
The most striking word in Christian's reply was "splash". Dit you search for it on
CodeProject ? This site has thousands of articles, some are dealing with your problem,
I'm sure.
Luc Pattyn
|
|
|
|
|
At it's most obvious, create a form that has a progress bar in it, and a public method called Step() which moves the progress bar forward. Call it SplashDlg.
In your main form class make it a variable:
public static SplashDlg splash;
As early as you can in your code, create it:
splash = new SplashDlg();
splash.Show();
where-ever your program progresses in the things it has to do to load, call this:
splash.Step();
Work out how many steps you take and set the progress bar to have that many, and you're done.
OR, as Luc said, take the word 'splash' as a clue on what to google for more info.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
How can I get the mouse position from desktop?
thank you
|
|
|
|
|
Control.MousePosition gets the position of the mouse cursor in screen coordinates.
Luc Pattyn
|
|
|
|
|
In C#:
I am building the MessageBox parameter:
MessageBoxButtons.OK
from a string. The string is defined this way:
string buttonSelected = “MessageBoxButtons.” + selectedButton;
selectedButton is defined elsewhere in the program, lets say as “OK”.
When I call MessageBox, I try to cast the parameter MessageBoxButtons like this:
MessageBox.Show(“test”,”test”, (System.Windows.Forms.MessageBoxButtons) buttonSelected);
I get an error that says I cannot convert type string to System.Windows.Forms.MessageBoxButtons.
Why can’t I do this?
Vern
|
|
|
|
|
In general you can not cast a string to just any kind of object you are dreaming of.
You can do the opposite, that is each kind of object has a ToString() method (inherited
from Object) to give you a string representation (although the default implementation returns
simply the type name, not always very useful; but you can and should override the ToString
method).
If you want to communicate about message buttons between different pieces of code,
you should use a variable of type MessageBoxButtons.
Example:
MessageBoxButtons myButtons;
bool withCancel=false;
if(withCancel) myButtons=MessageBoxButtons.OKCancel;
else myButtons=MessageBoxButtons.OK;
... whatever other things you want to do
MessageBox.Show("text", "caption", myButtons);
Luc Pattyn
|
|
|
|
|
Luc:
Thanks for the response. I did finally end up using some code that used MessageBoxButtons and MessageBoxIcon variables.
Thanks again.
Vern
|
|
|
|
|
You can use enum.Parse to turn a string into an enum instance
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Christian:
Thanks for you response. The enum.Parse was a good tip.
Thanks again.
Vern
|
|
|
|
|
Hey i have a datagrid that when a mouse is moved in the cell it is supposed to display the tooltip with information for some reason it isn't working. i tested it on a textbox and it works fine. But with the datagrid it is giving me major problems below is what i have
private void dgvCreditCards_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
{
ttInformation.SetToolTip(dgvCreditCards, "Help Me");
ttInformation.Active = true;
ttInformation.Show("This is a test", dgvCreditCards, e.RowIndex, e.ColumnIndex);
}
i even created the popup event for the Tooltip and set a break in it and it is actually catching. for whatever reason it just isn't working. Anyone know what i'm doing wrong?
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
If I remember correctly, there recently has been a discussion thread on a tooltip
that varried with the cells of the DataGridView. So I suggest you use the magic
"search comments" button with the appropriate keywords.
Luc Pattyn
|
|
|
|
|
Just thought of the question and since it is more of a programming question I'm posting it here and not the Lounge.
How would you take a transparent form and place it where the desktop icon set on-top of the form.
For example:
A simple clock app.
|
|
|
|
|
If the form is transparent why does it need to go "behind" anything?
I believe the Desktop is a ListCtrl window... use Spy++ on it. So I think it paints those icons.
led mike
|
|
|
|
|
It is transparent to allow the desktop image the show through but behind the desktop icons so that they are still able to be seen and used.
|
|
|
|
|
I have a datacolumn that is defined as decimal in a stored procedure with 28 digits (4 of them for decimals), is there a way I can get the 28 back from this as the length in any property or any other way ?
I need this dynamically, as I don't want to hardcode 28 in case the size increases/decreases.
I noticed on nvarchar fields the maxlength is set, but on decimal, datetime and int fields these are always -1.
Thanks
|
|
|
|
|
Either stop thinking of numbers as a sequence of digits or convert them to VARCHAR.
|
|
|
|
|
I don't think there is a convert to VarChar in C#.
|
|
|
|
|
I have crated a table called employee. My form contains a textbox with label 'fname' and a button (find). I have created a datset and datagridview.
When my forn load I can see all the data(of the empolyee table)in the datagridview. When a user enter text in textbox and presses 'find' button the datagridview must get refreshed and show rows where employee.firstname matches textbox.text
How do I pass textbox.text value to the sql querybuilder(like select * from where clause employee.firstname = ?????) which can be used by dataadapter.fill method
Waiting for response
Thank you
|
|
|
|
|
Look at database articles on CodeProject that discuss using SqlCommand object.
led mike
|
|
|
|
|
I have an application that runs in the background and pops up windows with reminders, thing is I don't want it to pop up the windows if I play a full screen game. How can I detect if a full screen application is running?
|
|
|
|
|
Don't, but take a look at Form.Activate
|
|
|
|
|
If you really want this (and I can understand some popups are annoying in the middle of
a game), you could use PInvoke to get at EnumWindows, and check if there is any main window
with a size equal to the screen size.
It may be insufficient for exact size match (e.g. a maximized window is larger than the screen,
just check it), and having multiple monitors might also complicate matters.
Two prototypes to get you started:
/// <summary>
/// Enumerate all windows, calling a delegate for each of them.
/// </summary>
/// <param name="ewp"></param>
/// <param name="lParam"></param>
/// <returns></returns>
[DllImport("user32.dll", CallingConvention=CallingConvention.StdCall)]
public static extern int EnumWindows(LP_EnumWindowsProc ewp, object lParam);
/// <summary>
/// delegate used for EnumWindows() callback function
/// </summary>
public delegate bool LP_EnumWindowsProc(IntPtr hWnd, int lParam);
Luc Pattyn
|
|
|
|
|
How do I tell Visual Studio C# 2005 about a DLL supplied with my USB hardware (motor control - MotorBee). I need to be able to call the functions in the DLL. Is it so trivial that its obvious? (not to me!)
sysrev
|
|
|
|
|
See a previous message[^]
Plus:
chances are your USB dll is not a .NET dll but rather a native code dll.
In that case you dont need references and using, but you need PInvoke, i.e. the
techniques required to call native code.
Lots of examples are available on CodeProject. Prerequisite is some documentation
as to what functions are available in your USB dll.
Luc Pattyn
|
|
|
|