|
Thanks for your reply,
I get how to test is I can access it but I do not know how to ask it to try to connect.
I don't want to have to un-map the drive and re-map because that seems messy and will probably result in user-rights issues for some of my users
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
This[^] has a zRestoreDrive method that would appear to do what you require.
It is a more recent version of Map Network Drive (API)[^] from here on Code Project.
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.”
|
|
|
|
|
Thanks, I'll take a look
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Not supported in vista and later[^]
But it's given me something to search for, was getting no where before so thanks for that. I'll post if I get an answer
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
isn't MSDN great? they tell you the function is gone, but don't point you to a solution...
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
I know, I really was expected to get somewhere from that. Well maybe I can use this as an excuse to stop my users having Vista!
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
musefan wrote: Well maybe I can use this as an excuse to stop my users having Vista!
One needs an excuse?
|
|
|
|
|
hi,
i doing one stanalone application in that i am crearing a login control in this i am checking the name and pssw which stored in the data base if the name and passw present in data base then user get login else error mssg
i tried some here but when i run my prog. it shows runtime exception that connection not open need help
here is my code
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private OleDbCommand cmd;
private void Form1_Load(object sender, EventArgs e)
{
String connectionString = "Provider= Microsoft.Jet.OLEDB.4.0; Data Source= C:\\Login1.mdb; username=xxx;password=xxx;database=login1";
OleDbConnection connection = new OleDbConnection(connectionString);
connection.Open();
string selectString =
"SELECT Name, Password " +
"FROM login1 " +
"WHERE Name = '" + login.Text + "' AND Password = '" + psw.Text + "'";
cmd = new OleDbCommand(selectString, connection);
connection.Open();
String strResult = String.Empty;
if (strResult.Length > 0)
{
label5.Text = "YOU ARE LOGGED IN!";
}
else
{
label5.Text = "INCORRECT USER/PASS!";
}
connection.Close();
|
|
|
|
|
the exception holds file name, class name, method name and line number information.
And an IDE (such as Visual Studio[^] can be told to always show line numbers in editor windows.
Hence it is easy to spot where things go wrong; now read the error/exception message carefully, and check your code. Which I didn't read as it isn't properly formatted using PRE tags.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Could you provide the error detail.. I think some other issues are there....
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
There are so many things wrong with this! For example:
Mangesh Tomar wrote: connection.Open();
string selectString =
"SELECT Name, Password " +
"FROM login1 " +
"WHERE Name = '" + login.Text + "' AND Password = '" + psw.Text + "'";
cmd = new OleDbCommand(selectString, connection);
connection.Open();
Why try to open it twice?
Mangesh Tomar wrote: String strResult = String.Empty;
if (strResult.Length > 0)
{
label5.Text = "YOU ARE LOGGED IN!";
}
What do you think is going to happen? Magic?
I sugest you go right back to the begining - create a new project, connect to that database and read a single record from the table. When you get that working, start building up from there.
Oh, and Luc is right - preserve your formatting with <pre> and </pre> tags around you original code when you post it here. It make it easier to read, and thus more likely to be read. (And Luc is one of the people you really want to read your code - you will probably never learn half the stuff he has forgotten...)
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Hello.
Does anybody know, I'm searching for control, that can be created Icon automatically in taskbar, for example for showing network speed.
I just have an idea to create it manually, using Bitmap class, but I must draw it pixel for pixel. (For example: 100M)
Are there any easier way ?
Thanks.
|
|
|
|
|
hi guy,
you want show different icons in the systemtray for some actions that nobody knows. how can we make this dynamic without snipping with the finger ^^ you understand ^^
make your bitmaps with paint.. or some else and load it at runtime.
greetz
|
|
|
|
|
Dynamically created Icon for "Number" in Taskbar
Just 0...9
|
|
|
|
|
load bitmaps ^^
or draw the 0..9 to a bitmap from string then create the icon and show it ^^
|
|
|
|
|
Hi,
this draws into a bitmap:
Bitmap bm=new Bitmap(100,100);
Graphics g=Graphics.FromImage(bm);
g.FillRectangle(...);
g.DrawString(....);
and this turns a bitmap file into a simple icon file:
string filename=...;
try {
Bitmap bm=(Bitmap)Image.FromFile(filename);
if(bm.Width!=32 || bm.Height!=32) {
bm=new Bitmap(bm, 32, 32);
}
Icon icon=Icon.FromHandle(bm.GetHicon());
bm.Dispose();
string filename2=Path.ChangeExtension(filename, ".ico");
Stream stream=new FileStream(filename2, FileMode.Create);
icon.Save(stream);
log("Created icon "+filename2);
} catch(Exception exc) {
log("Failed to create icon from "+filename);
log(exc.ToString());
}
If all you need is a few different icons, run such code once and save the result as files or resources.
:)
<div class="ForumSig">Luc Pattyn
<hr>I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
<hr>Local announcement (Antwerp region): Lange Wapper? Neen!
<hr></div>
|
|
|
|
|
i have the following code
this code runs on LogIn form Acts as standby while other forms still opened
if(Application.OpenForms["MainForm"].MdiChildren.Length>0)
{
MessageBox.Show("!..you should close all opened windows before continue", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
Application.Exit();
}
when code running LogIn form disappeared and user can access any opened form
i want to only keep LogIn form running untill entering valid password
|
|
|
|
|
Dont use "Application.Exit();"
It will kill all forms and end your application.
Just close your MainForm and don't close your LoginForm.
|
|
|
|
|
hi,
only show your MainForm after a valid passord entered! is a much easier way..
and to cancel the OnClosing use CancelEventAgruments.Cancel = true
bless
|
|
|
|
|
|
I think this is constant for all the document you generate...design your template by considering this...
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
Hi all
do you know a way to amutomatic add a method to a class once this last is decorated with a C# custom attribute?
Thanks
MN
[MyAttribute("MyName")]
public class CA
{
public CA()
{}
};
CA obj = new CA();
obj.MethodDueToMyAttribute();
|
|
|
|
|
No, attributes only provide additional meta data, they can't do anything like that.
The only way to achieve that would be if the C# compiler detected the attribute and added the method when the class was compiled. Obviously, as you can't change the code for the C# compiler it's not something you can do - unless you fancy writing your own C# compiler.
I suppose you could add a pre-build event that searched through all the classes for the attribute and added the method, but as it would be running before the compiler, you would have to just to a text based search and modify the .cs file before it was compiled.
Simon
|
|
|
|
|
manustone wrote: CA obj = new CA();
obj.MethodDueToMyAttribute();
when class CA does not have a MethodDueToMyAttribute method at compile time (and there isn't a class holding an extension method for CA), this code will not compile.
Hence, you can create another DLL file with new functionality at run-time, however invoking the new stuff will take reflection code, not a simple call to a yet unknown method.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|