|
No, because System is a namespace and Console is a class. The using command allows you to specify which namespaces to "short circuit", but it does not do it with classes.
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I think you get me wrong. I want to declare a global variable that can use anywhere in the program named main.cs but I don't want to type a long command.
For example, I have this file named variable.cs
using System;
public class someclass
{
public static int a = 0;
}
And I want to use it in this file named main.cs
using System;
public class somemainclass
{
Console.WriteLine("a = {0}", someclass.a);
}
I don't want to use this someclass.a. So is there anywhere i can short cut it the someclass.a to a variable named a to use as normal?
|
|
|
|
|
I didn't "get you wrong". I understood perfectly what you were trying to do, but I was trying to point out to you that the .NET framework is OO based. You cannot declare your variables outside classes and you cannot shortcut someclass.a to a.
Hint - if you could do this, it would create some awful problems with namespace resolution and method name collisions, so .NET tries to protect you from yourself.
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
hello again
now i have an application to ( login ) using a username and a password ....
all usernames and passwords are stored in a database ( microsoft access )
can someone help me with the source code to verify the username and its password or give me a webpage explain it
thank you
-- modified at 10:14 Saturday 18th November, 2006
|
|
|
|
|
I can give you some general directions:
Check out tutorials for ADO.NET to learn more on connecting to the access database. There are quite a few articles on the subject, so it should be pretty simple to get started.
WM.
What about weapons of mass-construction?
|
|
|
|
|
Hi
If you like to use a database (for example access) to store usernames and passwords ,you can encrypt passwords so if someone has direct access to database can't use them.Then when a use wants to login get his/her password encrypt it(using the same encryption method for stored passwords) and compare it with the encrpyted password(For security reasons it's better to encrypt the provided password rather than decrypting the stored one)
If you like to prevent people accessing the database itself you should make it password protected ( an access database has two kind of authentication , you can provide a password for admin user or you can provide a password for the database itself.By defining a password for admin user you are defining a password for the access application not your database it means that if you want to open any database using your access application you should provide the admin password.
If you set a password for you database then the database is password protected and even if somebody gets a copy of it he/she can't open it unless he/she knows the password.
Regards
|
|
|
|
|
I'm using this code for printing a richtextbox content:
http://support.microsoft.com/kb/812425/ja
How can I find out the size of the printed text. Because the printed text is not the equal size of the richtextbox content, and so it can be that in the printed version one line of the richtextbox is printed in two lines...
And I need to know where the printed text ends? The Y-coordinate of the last line...
|
|
|
|
|
Hi all,
Can somebody give me some idea about how to get the current credential object in a windows application ?
Thanks and Regards,
|
|
|
|
|
Thread.CurrentPrincipal
This contains the identity of the current user and can be used to check if the user is in a specific role.
WM.
What about weapons of mass-construction?
|
|
|
|
|
Hi Willem,
Thank you very much for your reply, but i need it as a Credential object!!
James
|
|
|
|
|
You can also call WindowsIdentity.GetCurrent() , which will return a WindowsIdentity object.
What is it that you are doing that requires a Credentials object?
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
I'm a newby in c# , can any one help with how to implement a multidimensional array for a data warehouse with 5 dimensions and attributes listed below:
Tables
Product - product_id, Productname, subcategory, category, product family
Store - store_id, storename, store_address, city, country
Time - timeid, date, day, month
Inventory - inventoryid, ordereditems, stockitems, numbersold
Sales Fact Table - productid storeid, timeid, unit sales, unitcost, totalcost
|
|
|
|
|
What is it specifically with your homework that you need help with?
Why do you think that a multidimensional array is needed?
---
b { font-weight: normal; }
|
|
|
|
|
I would like to know how multidimensional arrays are implemented in C#
|
|
|
|
|
|
But may i ask, pardon me, why do you need a FIVE DIMENTIONAL array for this??!!!!
|
|
|
|
|
i have five tables , i want to populate the database using the arrays.
|
|
|
|
|
That's fine ..but 3 dimensions should be ok for your requirement!!
James
|
|
|
|
|
hi all,
What is the namespace to be used in C# for creating a Word Object (eg : Word.Window wnd = ThisApplication.ActiveWindow.NewWindow();)
also can anyone help me hoew to write two namespaces under one class
shani
|
|
|
|
|
Probably this one: Microsoft.Office.Tools.Word
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
|
Hello friends,
I have developed one application,
in that if user clicks on close button the application is minimize to system tray
if user want to close the application than user will right click on system tray
icon and click on close buton.
Now problem is when my application is in system tray
and if i am going to shutdown/restart/logoff my ocmputer than all processes
is going close but after that nothing is happening.
if i want to shutdown the computer than i have to close my application first
can anyone having idea regarding this??
please help me as soon as possible
any kind of help is appreciable
thanks in advance
Irfan Kothari
|
|
|
|
|
Add the following code to your form. It filters the session end message and sets a flag that can be tested in the Closing event handler.
protected override void WndProc(ref Message m)
{
if (m.Msg == 0x0011)
this.allowClosing = true;
base.WndProc(ref m);
}
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hello stefan,
i have found very simple solutuion to this problem.
before your posting
but than also thanks.
whenever we click on shutdown it will call form closing event in the application
and i have written following code in my form closing event.
this.WindowState = FormWindowState.Minimized;
this.Opacity = 1;
this.ShowInTaskbar = false;
if (this.FrmCloseFlg == false)
{
e.Cancel = true;
}
thats y my application is not going to exit instead it will be in minimize
position.
so i have used one boolean variable and use condition as follows
if(!InSystemTray)
{
this.WindowState = FormWindowState.Minimized;
this.Opacity = 1;
this.ShowInTaskbar = false;
if (this.FrmCloseFlg == false)
{
e.Cancel = true;
}
//UserCanceled = true;
UserInfo.InSystemTray = true;
}
else
{
Application.Exit();
}
The InSystemTray will set to false again whenever we manually clik on open context menu or double click tray icon ,whatever it is.
is it simple na!!!!!
So we dont have a right to call any person an idiot ok buddy,be cool
Regards,
Irfan Kothari
|
|
|
|
|
Hi,
He didn't called you an idiot. Its his signature
Like you got yours:
"Regards,
Irfan Kothari"
|
|
|
|