|
The log variable is simply this:
log=this.txtBxUsername.Text + ", " + DateTime.Now;
I want only to record the username and the time the user logged on.
administrator, 1/16/2006 10:55:37 AM
တတတတတတတတ襢⭺鉳䀗霳ꇳtrator, 1/16/2006 10:55:48 AM
တတတတတတတတ垵쌂멨蛫륢trator, 1/16/2006 10:56:02 AM
တတတတတတတတ뙩鲂팒ᬵ밞拑䔏⎗trator, 1/16/2006 10:56:15 AM
This is an example of the output I receive.
|
|
|
|
|
How is it that you get a multi-line file from code that only writes one line?
[edit]Oops, just looked back and saw the APPEND option when you open the file. That's the problem.
You need to write the entire file each time if you plan on encrypting and decrypting it. It appears that you accidentally read some of it because you are using the same key and initialization vector each time.[/edit]
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
-- modified at 14:20 Monday 16th January, 2006
|
|
|
|
|
The file is written to every time a user logs on to the application. I'm appending the new user information to the document each time the user logs on. So, the WriteLine is performed once each time through the application, but the file is appended the next time through.
|
|
|
|
|
I just modified the previous post to comment on this behavior. Check it out.
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
So, would you suggest I read the file first and append the content to it the result of that read, then encrypt the whole thing? How are user logon records stored typically?
|
|
|
|
|
thepolishguy wrote: So, would you suggest I read the file first and append the content to it the result of that read, then encrypt the whole thing?
Yep.
thepolishguy wrote: How are user logon records stored typically?
I'm not sure there is a "typical" way. You might consider using a custom event log in Windows.
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
What are you using for line breaks? Use Environment.NewLine or "\r\n".
---
b { font-weight: normal; }
|
|
|
|
|
Hello, i have this code and i would like to prevent multipe new forms from opening
[quote]
private void View_Click(object sender, EventArgs e)
{
Export export = new Export();
export.Show();
}
[/quote]
Any Idea of how i can implement this?
D.M
-- modified at 11:01 Monday 16th January, 2006
|
|
|
|
|
Have a bool value and set it to true when the export object is created.
bool exportCreated = false;
private void View_Click(object sender, EventArgs e)
{
if (!(exportCreated))
{
Export export = new Export();
export.Show();
exportCreated = true;
}
}
Until you set exportCreated to false a new export object will not be able to be created.
Cheers
Kev
|
|
|
|
|
You can show your form as modal dialog
<br />
private void View_Click(object sender, EventArgs e)<br />
<br />
{<br />
Export export = new Export();<br />
export.ShowDialog(this);<br />
}<br />
<br />
<br />
DevIntelligence.com - My blog for .Net Developers
|
|
|
|
|
thanx a lot both of u
D.M
|
|
|
|
|
hi!
you can also try this...
private Export m_frmExport = null;
private void View_Click(object sender, EventArgs e)
{
if (m_frmExport == null || m_frmExport.IsDisposed)
{
m_frmExport = new Export();
m_frmExport.Show();
}
else
{
//If the m_frmExport is not yet closed/disposed, this will set the focus on this form.
m_frmExport.Activate();
}
}
hope that helps.
|
|
|
|
|
is your export form should be modal?
If not, you can make your export form as class member and construct it in your main form contstructor and at View_Click(..) you can write only
exportForm.Show();
Hope this help
Hesham
|
|
|
|
|
How can I know the size an object in memory?
Anyone?
vSoares
|
|
|
|
|
You can use sizeof or Marshal.SizeOf. However, that doesn't take into account the memory used by the garbage collector to track the object.
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
How can i close an application using C#? I have tried using the Process.Kill method and it works pretty well, but does this method force the application to close or does it tell it to close. For example, i have noticed that many applications save a lot of thier settings while closing but when i use the Process.Kill method, they just seem to close forcefully. How do I go around this?
|
|
|
|
|
|
hi guys,
how can i write data/information from the database server to a file stored in the client PCs of my network. can i do it at the same time? if not its ok, as long as i can send all the data to all my client PCs.
the data is not that big, about 20-30 lines of text.(3-5 words per line) it just contains a list of information to be used by my Client side program... tnx..
|
|
|
|
|
Hi there,
I would like to use a progress bar in my application. What i am looking for is a wakeup bar that goes from 0 to 100 and back to 0 again. I would like run it when the process is running so that user know that process is running. Appreciate any feedback.
JS
-- modified at 10:20 Monday 16th January, 2006
|
|
|
|
|
You can use:
progressBar1.PerformLayout();
Or
Application.DoEvents()
SINCERELY ANTHONY ACUÑA
PREFERED PHRASE:
SOMEBODY TELL ME WHY IS MORE REAL WHEN I DREAM THAT I AM WAKE?
|
|
|
|
|
Thanks Anthony,
Application.DoEvents() is what I was looking for. It did the trick.
Thanks again.
JS
|
|
|
|
|
Hi,
Is it possible to tell the Visual Studio 2003 to not print the "The thread '<no name="">' (0x11c4) has exited with code 0 (0x0)." messages in the output window? And if yes, how?
Thanks
Roland
Hi! I'm a signature virus. Copy me into your sig file and help me spread!
Follow your Euro notes in their tracks
|
|
|
|
|
Hi
Does anyone know what TypeConverter to use to open a OpenFileDialog from the propertygrid?
Thank you,
D
|
|
|
|
|
Hi D
this is the code:
[Browsable(true), Description("The filename for destination.")]
[EditorAttribute(typeof(System.Windows.Forms.Design.FileNameEditor), typeof(System.Drawing.Design.UITypeEditor))]
public string FileName
{
get {return _FileName;}
set {_FileName = Path.GetFileName(value);}
}
|
|
|
|
|