|
Will that be good to start application message loop (Application.Run ) only after validating login?
|
|
|
|
|
N a v a n e e t h wrote: message loop (Application.Run) only after validating login?
You don't need a mesage loop to construct a form or anything else; you need one to get it alive on the screen. Me creating the form before Run() gives me a reference so I can get at its Success property afterwards.
Your code below is fine too, there you make the LogonForm modal, so it gets its own message loop from ShowDialog.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
crazylad wrote: If I use Application.Run(new LogonForm()) and try returning a boolean parameter to indicate successful/unsuccessful logon, the project doesn't build successfully.
IMO, you need to use Application.Run only when the login is successful. As I said, before calling Application.Run , validate the login and if successful call it. To get the validation result back, you can use DialogResult enum provided with .NET framework. You can do like this,
int main()
{
bool loginValidated = false;
using (LoginWindow window = new LoginWindow())
{
loginValidated = window.ShowDialog() == DialogResult.OK;
}
if(loginValidated)
{
Application.Run(new ProcessForm());
}
} Inside the login form, once you validate all the details, write like
this.DialogResult = DialogResult.OK;
|
|
|
|
|
N a v a n e e t h wrote: IMO, you need to use Application.Run only when the login is successful. As I said, before calling Application.Run, validate the login and if successful call it. To get the validation result back, you can use DialogResult enum provided with .NET framework. You can do like this,int main(){ bool loginValidated = false; using (LoginWindow window = new LoginWindow()) { loginValidated = window.ShowDialog() == DialogResult.OK; } if(loginValidated) { // starts the application message loop Application.Run(new ProcessForm()); /* .... */ }}Inside the login form, once you validate all the details, write like
this.DialogResult = DialogResult.OK;
Navaneeth & Luc, thank you very much for your response. It was of great help. I also happen to come across an article about passing data between forms. I'm providing the link in this post for the benefit of anybody that is looking for the same information.
Passing Data Between Forms[^]
Thanks again for your help!!
|
|
|
|
|
I know several ways to hide individual properties, and in something I'm working on I do it using a Designer , more specifically by overriding the PreFilterProperties method
protected override void PreFilterProperties(System.Collections.IDictionary properties)
{
properties.Remove("Dock");
properties.Remove("TabStop");
properties.Remove("TabIndex");
properties.Remove("Visible");
properties.Remove("Enabled");
properties.Remove("Locked"); <===========================================================
properties.Remove("Anchor");
properties.Remove("Name"); <===========================================================
properties.Remove("AutoSize");
properties.Remove("AutoSizeMode");
properties.Remove("Location");
properties.Remove("Size");
properties.Remove("MaximumSize");
properties.Remove("MinimumSize");
properties.Remove("BorderStyle");
properties.Remove("GenerateMember");
properties.Remove("Modifiers");
properties.Remove("Design");
base.PreFilterProperties(properties);
}
The two properties marked still show up however.
They are both in the 'Design' Category, so even if the code above worked, I would still be left with an empty Category. So
1) anybody got any ideas about why the two properties remain and/or how to get rid of them.
2) any ideas on how to remove the 'Design' Category. If you look at either of the Panels in a SplitContainer , they don't have a Design Category, so presumably it is possible.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hello Sir Henry,
my undercover informant told me the secret of SplitContainer panels is in this line:
[EditorBrowsable(EditorBrowsableState.Never), Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
Hope that helps.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi Luc,
Thanks for that. I had completely forgotten EditorBrowsable , so this was a useful reminder. Unfortunately these attributes are of no help in my case.
I have discovered, through experimentation and reading the documentation that Locked , certainly, and Name must be guilty by association, is not a Property of Panel , which my class descends from. It therefore must be provided by an Extender Provider in the host designer. I vaguely remember reading this about Name somewhere anyway. So it's another round of googling and reading, unless your good self or A.N. Other has a solution.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I got some more info for you:
1. Locked is not a run-time property of most Controls; only a few (ToolStripPanel) have it.
It seems to exist inside VD only.
2. Name is completely different; it is a property of Control, public and not virtual. It is Browsable(false) so the "(Name)" you see in VD isn't the real thing.
And some specialized controls have their own Name property, not new, not override, not virtual?????
That will be all from me on this subject.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Cheers.
More ammunition for the Google gun.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Good morning Henry.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Bonjour, Luc.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Oy Statler, we speak Dutch around here. Goede middag ondertussen.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi friends,
In my application from windows form i am going to open one URL in IE...in that web page[PAGE 1] after passing UserName & password it will redirect to other page[Page 2]....that page contain IFrames....
Now from that page i have to redirect to another page[PAGE 3]...
but URL of Page 3 is different..
I mean to say if Page 2 URL is https://www.google.com
Than Page 3 URL will be https://www.abcgoogle.com....but due to Iframe when i redirect from page 2 to page 3 address bar url will not change due to Iframe....
Now when i am on Page 2 when i mouse over on link button(which redirect me to third page)...at that time on status bar it is display this URL(https://www.abcgoogle.com)
Now my problem is From page2 how can i get status bar value??? so finally i redirect to third page.....
REgards,
Hemant Patel.
|
|
|
|
|
Windows 7 is released for developers today. It's available to MSDN subscribers. I've put together a list of Microsoft programs for developers for getting Windows 7 and developer tools including MSDN subscriptions at big discounts at http://tinyurl.com/newahd[^]
If you are a startup, your MSDN subscription can be nearly free through BizSpark[^]. The post also describes the free programs that are available for software companies to get your applications compatible, publicize compatibility, and to be listed on Microsoft sites.
|
|
|
|
|
Hello, I'm working on a developing a windows application which displays file names as link labels on a form. The files are saved in an Oracle database table as BLOBs. The files can be of any format .jpg, .gif, .pdf, .tiff, .htm, .pdf, .zip etc. When the user clicks on a link label, I am retrieving the corresponding BLOB from Oracle and have converted into byte array. I'm stuck on how to stream this byte array for the user to save in his desktop. If there is a way to even save and open the file systematically also, that would be great.
Any help from you is greatly appreciated.
|
|
|
|
|
You can do this using the FileStream class. Like this:
FileStream oFileStream = new FileStream("FilePath", FileMode.OpenOrCreate);
oFileStream.Write(YourByteArray,0,YourByteArraySize);
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Hello D@Nish, thank you very much for your response. Is there a way to open the file systematically as soon as the save is complete? Thanks again for your help.
|
|
|
|
|
Use Process.Start method once the save is complete. It will open the file in the associated program.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
d@nish wrote: Use Process.Start method once the save is complete. It will open the file in the associated program
It worked. Thank you d@nish!!
|
|
|
|
|
Thanks in Advance,
While debugging anything in Visual Studio cannot see in debugging mode that whats going on the application
lets say i have a Text Box control and i wrote code for it
TEXTBOX1.text ="Hello World"
now while debugging i want to see the values on my application that ok it has set this value now or not
Any alternate or suggestion
Best Of Regards ,
Mirza Rahman
|
|
|
|
|
The application is halted when it hits a breakpoint. Hence, it will not paint the form.
You can add a "watch" in order to inspect the value though
|
|
|
|
|
Yes you are right but any other way instead of adding watch window because my scenario involves so many controls and grids any how thanks for Helping
|
|
|
|
|
Call Application.DoEvents() after setting the textbox value.
while (e) { Coyote(); }
|
|
|
|
|
Hello All,
I have list that is globally declared and i have add button which will add one object to the list once it clicked .
I am binding this list to grid .
for the first time when i click add button item is added to the list and binded to grid too.
when i again click the same then it added the item to the list but still not reflected to grid and then i have done some modifictions and get the result.
please find the code
private void btnAdd_Click(object sender, EventArgs e)
{
objSapient.Add(new SapientDetails(txtName.Text,txtSapientID.Text,txtProjectName.Text,txtPhoneNumber.Text,txtExpr.Text));
if (objSapient.Count != 0)
{
grvDetails.DataSource = null;
}
grvDetails.DataSource = objSapient;
}
why do i need to set as datasource to null ?
why just grvDetails.DataSource = objSapient; is not sufficeint .
Please tell the reason for the same
|
|
|
|
|
Not sure about this behaviour.
But to avoid setting the datasource to null, use a BindingSource object to set the datasource of the DataGridView. Set the DataSource of the object as your list. And on button click, just add the item to the BindingSource object. This will add item to both the List and the DataGridView.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|