|
a basic version would be:
string Password;
string Username;
///WHEN THE USER PRESSES OK///
{
if (tbUsername.Text == Username && tbPassword.Text == Password)
{
this.Close() //close the password entry form
form1.Enabled = true; //assuming the main form is form1
}
else label1.Text = "Username / Password Combination does not match";
}
you cannot really copy and paste this, but thats just lazy anyway
It should give you an idea of the structure you need to use for your program
Regards
James
|
|
|
|
|
hi
i lock a file.. and i acces this how i can unlock this file
in c#..
plz send me any article, code, help for that problem..
Never Think That You Have Failed Instead Always Think That u hav Better Chance Next Time...
|
|
|
|
|
What do you mean by locking the file?
If you mean that you lock it as you open it, simply close it.
---
b { font-weight: normal; }
|
|
|
|
|
When I get the image from the file the file remains locked
hi,
Can you help?
When I get the image from the file the file remains locked so the Delete
fails with a "used by another process"
how can i unlock this file...................?
its urgent plz help
and if any code and article
send me on
nicevirendra@rediffmail.com
thanx
Never Think That You Have Failed Instead Always Think That u hav Better Chance Next Time...
|
|
|
|
|
As I see the file stream remains open .
You may copy the image into MemoryStream, then close FileStream .After this you will be able to delete the file and play with the image as you want.
DevIntelligence.com - My blog for .Net Developers
|
|
|
|
|
Actually prob is that:
i save an image...
but when im update image... i want to delete old image frm my IMAGE folder...
i use..
Image = Image.FromFile(imageFileName)
: and thow the error :
this is used by another procees
help me out .....
thanx
Never Think That You Have Failed Instead Always Think That u hav Better Chance Next Time...
|
|
|
|
|
This code snippet reads image file, show it in PictureBox then delete image file from the disk.
<br />
try<br />
{<br />
MemoryStream ms = null;<br />
FileInfo fi = new FileInfo(textBoxFilePathName.Text);<br />
byte [] buffer = new byte[fi.Length];<br />
<br />
using( FileStream stream = File.Open(fi.FullName, FileMode.Open) )<br />
{<br />
stream.Read( buffer, 0, (int)fi.Length );<br />
ms = new MemoryStream(buffer);<br />
}<br />
<br />
Image img = Image.FromStream(ms);<br />
pictureBox1.Image = img;<br />
<br />
File.Delete( textBoxFilePathName.Text );<br />
<br />
ms.Close();<br />
}<br />
catch (Exception e1)<br />
{<br />
MessageBox.Show( e1.Message );<br />
}<br />
<br />
DevIntelligence.com - My blog for .Net Developers
|
|
|
|
|
If you load an image from a file, the file remains locked until you call Dispose on the image object.
---
b { font-weight: normal; }
|
|
|
|
|
Hey, howzit, anyone know a good place to get good FREE C# eBooks?
|
|
|
|
|
|
imsathy wrote: gimme ur mail id
If it is a valid free eBook then you can link a URL to it. We don't condone the distribution of copyrighted material. Someone had to write that book and its sales put food on that author's table and a roof over their head. The bottom line is that distributing copyrighted material without the creators consent is theft.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
saravanan_article@yahoo.com
|
|
|
|
|
I dont know of e-books as such, but there are many good reference sites such as Coding4Fun at http://msdn.com/coding4fun - it contains tutorials to make sample applications ranging from a LCD driver to a GPS-Wired application.
|
|
|
|
|
|
|
can somebody give a simple login validation program, i'm a newbie and i just need it for a refernece.thank you!
|
|
|
|
|
it's very simple
just get the text values of the textboxes that u
have used to accept the username and password and
then check those values with the valid username and password
if they match then the user is allowed to login
else the error message is displayed.
Regards,
Pramod
|
|
|
|
|
thank you! I'll create one and try running it.
|
|
|
|
|
I am having a problem here with my project development. I would be glad if someone can help me out with this. Here comes.
I am trying to look for a way to find back the reference of a created object. Its something like vb6 callbyname but even using callbyname, i still need to have the reference of the object before i can use the callbyname.
Thanks.
MiaoMioa
|
|
|
|
|
can u e more specific about ur problem
if u have created an object u have a reference to it
then y do u need a reference to it again?
|
|
|
|
|
I have something like the below code which might be reasonable to be in this way when there is just a 1,2 class and 1,2 property. But now i am having like 10++ different classed with each class having dozens of properties that i need to get and return the value which the name i can only know when its running coz its classname/propname is from a database table.
*********************************************
Select Case ClassName
Case "Class1"
Select Case PropName
Case "Prop1"
Return clsObj1.Prop1
Case "Prop2"
Return clsObj1.Prop1
End Select
Case "Class2"
Select Case Key
Case "Prop1"
Return clsObj2.Prop1
Case "Prop2"
Return clsObj2.Prop1
End Select
End Select
*********************************************
I was thinking to do something like
*********************************************
Select Case ClassName
Case "Class1"
return myType.InvokeMembers(PropName, Binding.GetProperty, clsObj1, nothing)
Case "Class2"
return myType.InvokeMembers(PropName, Binding.GetProperty, clsObj2, nothing)
End Select
*********************************************
This actually works but only problem is i still need to do this numerous time for each object. Is there somewhat a way to get back the reference of created object by name/type of the object so i do not need to code like this.
Thanks for ur reply.
MiaoMiao
|
|
|
|
|
Here in the select case u check the Classname
so u can create an object of that class and through
that object u can get all the properties of that class
and then do as u wish.
Hope u get it
Regards,
Pramod
|
|
|
|
|
I can get what u mean but problem is am not trying to create a new object from the class name. Actually the object is declared at module level and created during page_load. When a button_click is trigger, i need to get this value from the existing object instead of recreate the object again.
MiaoMiao
|
|
|
|
|
So wht happens to the object that u have created during the page load event
can't u use the same object in the button click event?
Regards,
Pramod
|
|
|
|
|
Yes, ofcoz i can use back the object i create previously but problem is if i have 10 different data object and during the button click, i need to select which object to use, then i would need to have 10 cases rite. It really seems not right to do like this way but i couldn't get any other way to do so. That's why i would like to seek if anyone have meet this problem and have a solution to it.
|
|
|
|