|
|
I'm looking for a way to make an authentication form to my windows form based app. I want this form to be left in front of the parent main form, until user succeccfuly authenticate. If he press cancel it close the parent form. No other from may be load in front if this authentication form.
TIA,
Ronen
Ronen
|
|
|
|
|
You may use the ShowDialog() method to wait for a response and cast its return with DialogResult class.
Or in the Deactivate event of this login form write:
Activate().
|
|
|
|
|
I'm looking for a way to make an authentication form to my windows form based app. I want this form to be left in front of the parent main form, until user succeccfuly authenticate. If he press cancel it close the parent form. No other from may be load in front if this authentication form.
TIA,
Ronen
Ronen
|
|
|
|
|
Make it modal.
When you load you're authentification form, call
theAuthForm.ShowDialog(parentForm); and that's probably enought but if you are looking to have the dialog abolutely on the top of all the others application windows , try the property theAuthForm.TopMost=true.
I hope I've correctly understood your question.
Julien
|
|
|
|
|
I have Form1 (main form) containing menues, and etc...
Then by clicking on the menu options in Form1, I invoke the children of Form1 :
private void menuNew_Click(object sender, System.EventArgs e)
{
string a = "New_Click";
Form2 fNew = new Form2(a);
fNew.MdiParent = this;
this.menuNew.Enabled = false;
fNew.Show();
}
something like that.
When I am ready to close fNew form, how do I set menuNew back to enabled.
I know you can do it prety easily using ShowDialog, but I have to do it with MdiParent settings.
Thank you
|
|
|
|
|
Make a public property of the Form1
public bool NewMenuEnabled
{
set{ this.menuNew.Enabled = value; }
}
And when your MDI form is closed, go something like
((Form1)MdiParent).NewMenuEnabled = true;
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Homosexuals for Christ, Yeah!
Judah Himango
|
|
|
|
|
One approach I woulds suggest is that your parent register with the child Closing() or the child Closed() event. Then when the application window is closing, the parent can reset the menu.
There are 10 kinds of people in the world.
Those that read binary...
...and those who don't.
|
|
|
|
|
I want to know if there is a way for me to read decrypted data from a CryptoStream and added it to a HashTable. Right now I write the decrypted data to an xml file and then read the data back in from the xml file and add it to a HashTable. I want to skip the part of writing the data to the xml file and just add it directly to the HashTable. However, the CryptoStream class does not have a ReadLine() or Peek() method. I need to be able to read one line or character at a time. Any help would be appreciated, thanks.
|
|
|
|
|
The CryptoStream is a byte stream, not a text stream. Depending on the encoding of the encrypted data, one byte might not correspond to a character. If the encoding is utf-8, for an example, some characters may use more than one byte.
You need a StreamReader to read directly from the CryptoStream to get the encoding right. Example:
StreamReader reader = new StreamReader(cryptoStream, System.Text.UTF8Encoding);
---
b { font-weight: normal; }
|
|
|
|
|
While creating C# Class Library (DLL) Using Visual Studio .NET, once we have created the dll file, then if we want to use the dll file in someother projoect then I have to add it as a reference by Project->Add reference. I was wondering if I have to do it everytime I create a new client program or just I have do it once and then in each client project/program I can call the namesapce by
using mcMath; \\ Assuming that my dll is called mcMath
|
|
|
|
|
You would stil have to add the reference to each application that you wrote that uses this .DLL.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Can I create an installer which installs itself and I don't need to add it as a reference always?
Regards and Thanks a lot,
Amit
|
|
|
|
|
There's no such thing. The only way to get this functionality is if you modify the project templates to include your reference in the default list of references for that project.
There's no such thing as just typeing using ... and having the reference automatically made. The only reason you think you see this is because the namespace that your using is part of an existing reference.
Try it, create a new C# application, but don't add anything to it. Look under References and you'll see that there is a default set already made. Look in the Object Browser and you'll find that every namespace under those references (the .DLL's) is available just by typing using ... at the top of your code. But this exists ONLY because the references have already been made.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
My software (C# Winform) need to connect to a website to download a file.
The file is sought on the website with the login and password, then given to the client to download.
If I try with the browser, the website gimme a page with the password and the login and a "Connect" button.
I would like to emulate that work, without using the browser.
I'v no problem to connect to the Url and to download, but don't know how to send the login and passwor. I've try the code below, but it doesn't work.
<br />
MyLogin = "Me"; <br />
MyPassword = "11111111"; <br />
MyUrl = "http://mySite.com/MyPage.php"; <br />
clsDownLoadFile MyDownload = new clsDownLoadFile(); <br />
clsDownLoadFile.htmlStream MyStream = new clsDownLoadFile.htmlStream(); <br />
MyStream = (MyDownload.FindUrl (MyUrl, MyLogin, MyPassword)); <br />
if (MyStream != null) <br />
{ <br />
if (MyDownload.IsWebConnected()) <br />
{ <br />
string s = "login="+MyLogin+"+passwd="+MyPassword; <br />
WebClient myWebClient = new WebClient(); <br />
Stream postStream = myWebClient.OpenWrite(MyUrl,"POST"); <br />
postStream.Write(postArray,0,postArray.Length); <br />
postStream.Close(); <br />
try <br />
{ <br />
myWebClient.DownloadFile(@"C:\Temp", "MyFile.zip"); <br />
} <br />
} <br />
} <br />
I catch an exception when trying to download. I thought beacuse the Identification on the server doen't accept me.
Could someone help me, I drown...
|
|
|
|
|
no expert opinion on my problem?
|
|
|
|
|
Hello,
I have a progress bar and i have the min set to 1 and the max set to 100. I want to be able to click on part of the progress bar and for the progress bar to go to the value that l click on in the progress bar.
For example if the progress is on 10, and l click on the bar in the area of about 80, then the progress will go up to that value of 80.
Many thanks in advance,
Steve
|
|
|
|
|
Weird usage of a progress bar... but you can handle the mouse down and check where the click occured. Based on the location and the size of the progress bar you can determine the value to set.
Alex Korchemniy
|
|
|
|
|
You'd have to handle the MouseDown event of the Progress control. In there, you would get the mouse coordinates where where the user clicked the mouse button. Call the control's PointToClient method with those mouse coordinates to get the point mapped to a usable point in the control. You then have to do some math to determine how far from the left side of the control the user clicked the mouse, then map that number to a value between 1 and 100 so you can set the appropriate value in the ProgressBar's Value property.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
steve_rm wrote:
I have a progress bar and i have the min set to 1 and the max set to 100. I want to be able to click on part of the progress bar and for the progress bar to go to the value that l click on in the progress bar.
Why not use a TrackBar instead?
Roy.
|
|
|
|
|
Process.Start appears to only be able to start a process on the same machine.
Is there a way to start a process or preferably a php program on a remote machine.
What I want is to call a php on the server from a C# program on a workstation.
Regards,
Alf Stockton
|
|
|
|
|
StrayGrey wrote:
Process.Start appears to only be able to start a process on the same machine
True. Otherwise this is a HUGE security risk.
StrayGrey wrote:
Is there a way to start a process or preferably a php program on a remote machine.
You would need to use WMI and the System.Management namespace to launch a remote executable. You'd also need to provide credentials to an account that has administrator rights to the target machine.
Win32_Process[^] WMI class, Create method.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i just want to know if i make an applet i mean like java applet and integrate it with html or php to a web page (not using asp.net) now for any client using that applet must have .NET frame work installed but does the server must also have .NET framework installed. i think U understand my question :s
|
|
|
|
|
Yes, your client must have the .NET Framework installed for it to run. If your server is going to be executing managed (C#, VB.NET, Managed C++, ASP.NET) code server-side, then the server has to have the .NET Framework installed also.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
so you mean .. if i make a game in C# only client side and i use php on server side both clients need to have .NET framework installed but server doesn't neeed to.
thax man ..
|
|
|
|