|
Create your LoginForm object in the Load_event (Idon't know what it's named) and call the show method (ShowDialog) and when the Load_event method returns your LoginForm object is destroyed!
Did I understand you right!?
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
Hi Rickard,
Thanks for prompt reply.
Actually, I'm making instance of Login Form in Main() class after performing certain checks.So, roughly...
public static void Main()
{
if(oneCheck)
{
if(anotherCheck)
{
LoginForm loginForm = new LoginForm();
Application.Run(loginForm);
}
else
{
//Some Code
}
}
else
{
//Some Code
}
Now in that LoginForm in the click event of OK button I'll check wheather
password is correct or not.
If password is correct My Main MDI form should open and if password is wrong one message box should open stating Password is wrong.
So in click event of OK button, LoginForm should be destroyed and either my main MDI application or message box should get open.
I hope now it should be preety clear now.
Thank you very much.
Pranoti
|
|
|
|
|
You could also check if password is correcxt in the LoginForm's buttonX_click event.
If wrong do nothing than or show a message box that tells you that it's wrong password and if it is correct password then exit dialog and TADA.... I don't know any other way so that much I can help you!
But I would do like this.
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
How do I authenticate a user account, given the user name, password and domain(if any), using C#? Basically I am trying to avoid duplication of the user database just for this purpose..
|
|
|
|
|
There is a classes that you may look at System.Net.NetworkCredential, System.Net.AuthenticationManager. But it works in conjunction with webrequests. See if it might be possible to use it
Otherwise you may need to use LogonUser API.
|
|
|
|
|
Hi All,
I am having an annoying problem that hopefully you can explain to me.
I have some code in my Page_Load event that load previous data into all the textboxes on a form.
I then enter my new data and submit, but for some reason it is clearing all the data in my form before submitting, the only reason that I can come up with is that it is loading the Page_Load event which is populating the form with blanks from my database?
Does this make any sense and can I fix this?
Thanks,
Gavin
|
|
|
|
|
try this:
<br />
if(!IsPostBack)<br />
{<br />
}<br />
Andy Gaskell, MCSD MCDBA
|
|
|
|
|
That solves it..
Thanks,
Is there a decent reason on why it is running the Load_Page after I push submit and before the actual submit?
|
|
|
|
|
This might help.
Andy Gaskell, MCSD MCDBA
|
|
|
|
|
Hello All,
Is it possible to find out what kind of connection a remote machine has open ? I need to know both the inbound and outbound connections. Can WMI do to for me ?
-Koby
|
|
|
|
|
Hi,
How can I iterate the resource file? Like if I want to read all the values from the resource file how can I do it also I want to read in the same order as it is in resource file. Also I want to use the ResourceManager to do that.
Thanks a ton.
|
|
|
|
|
It's easy to set a background image...
BackgroundImage = ((Bitmap)(resources.GetObject("$this.BackgroundImage")));
But I don't want it tiled. I'd rather have it centered in the middle of the form.
Any thoughts?
Thanks!!
|
|
|
|
|
You can draw it yourself through the Paint or PaintBackground event.
protected override OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
int x, y;
x = (ClientSize.Width - backgroundImage.Width) / 2;
y = (ClientSize.Height - backgroundImage.Height) / 2;
e.Graphics.DrawImageUnscaled(backgroundImage, x, y);
} Where backgroundImage is an Image containing the image you want to draw in the background. You shouldn't also set the BackgroundImage property of the form because it will still tile the image in the background AND draw this one centered in the client area.
James
Simplicity Rules!
|
|
|
|
|
Thanks James.
Your method certainly works and perfectly fits the bill, but was trying to think of a very .NETish way of doing it. (Trying to convert from MFC to .NET)
I came up with the idea of putting a PictureBox on the form, then set the image and the propertiesDock=fill and SizeMode=CenterImage and it worked perfectly.
|
|
|
|
|
can someone give me a code
for handling word (as com object or else)
from c#
i realy need a way to add template, change font and size
i know how to open show each
|
|
|
|
|
check out this file in the .NET framework:
FrameworkSDK\Samples\Technologies\Interop\Applications\Office\Word\wordApp.cs
If you can't find it, just reply to this message and I'll email it to you.
|
|
|
|
|
I'm trying to use SetWindowsHookEx in C# so that I can get APPCOMMAND and KEYBOARD events from any window (not just my thread).
I created a DLL and put SetWindowsHookEx there, and then I'm using DllImport so that I can install hook in C# code.
As I receive events, I send a message to C# code through PostMessage.
The problem is that, even though I'm running SetWindowsHookEx globally, I just get events if my app window is focused. And if I use PostMessage, app runs really slow and almost crashes my machine, even though I have a powerful PC.
Has anyone here tried it before? If so, did you get a good performance? How?
I could do it perfectly in C++, but I need to use it in C#...
Thanks,
-Ricardo
|
|
|
|
|
Hi,
Have a little trouble passing a byte array in C# into a C++ implemented web service, the C# code is:-
FileStream fs = new FileStream("c:\\work\\temp\\Waremouse.mp3", FileMode.Open);
BinaryReader Reader = new BinaryReader(fs);
Reader.BaseStream.Seek(0, SeekOrigin.Begin);
long lLength = Reader.BaseStream.Length;
Int32 nLength = System.Convert.ToInt32(lLength);
byte[] bData = Reader.ReadBytes(nLength);
fs.Close();
//**********************************************
//C++ Web Service.......
m_FileServer.UploadFile("Waremouse.mp3", bData);
//**********************************************
The C++ is implement as COM interface as shown below
__interface IFBFileServerService
{
//Uploads a file onto the web server....
[id(1)] HRESULT UploadFile([in] BSTR bstrFileName, [in] byte* bData);
//Downloads a file from the web server...
[id(2)] HRESULT DownloadFile([in] BSTR bstrFileName, [out, retval] byte** bData);
};
The problem is that an exception is thrown in the client application
Cheers for any help
|
|
|
|
|
i download the "screen saver"(screensaver_JTJ.csproj);
and i wonder why it can download the codeproject.com's latest posts.it's code may be like this:
codeProject.LatestBrief latest = new codeProject.LatestBrief();
int nInterval = latest.GetArticleLatestUpdatePeriod();
arArticles.Clear();
codeProject.ArticleBrief[]articles=latest.GetLatestArticleBrief(latest.GetMaxArticleListLength());
TextActor a;
int nText = nTextPos;
Point velocity = new Point(0, -3);
if (null != articles)
foreach (codeProject.ArticleBrief article in articles)
{
if (article != null)
{
a = new TextActor(article.Title);
......
and it has a latest.wsdl file which i think related to it.
i want to know how to do that?i mean if i have a website like codeproject.com,how can i download such things?
any documents or articles that relate to that topic?
thanks in advance!
|
|
|
|
|
See this article!
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Sorry, I was too hasty in posting my reply. You'd have to convert my MFC code to C#.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Someone meet this MFC guy and tell him not to talk MFC in a C# forum
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
He's probably just trying to raise his post count.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
i will read that carefully!
then i will ask more questions maybe!
|
|
|
|
|
I have a C# form UI and I would like to create a web page from that. Anybody knows how to do that?
Thanks
Al
|
|
|
|