|
hi,
i'm creating a simple windows form control,this control contains
some panels but during design time this panels are accessible by clicking on them,i want to know what should i do inorder to disable selecting these panels...
|
|
|
|
|
You wrote :
some panels but during design time this panels are accessible by clicking on them,i want to know what should i do inorder to disable selecting these panels...
I am not getting your clear requirement. What got from this is , you are trying to control the accessiblity on design time. Accessibility is only come into picture when you use that perticular form.
If you can give clear picture of your requirement. Then i can able help you out.
Sreejith Nair
[ My Articles ]
|
|
|
|
|
hi,
you know,during design time i can select,change or move the panels but i dont want to do so,i just want to change he properties of panels by the properties panel which the parent gives to us...
thanks..
|
|
|
|
|
|
Select the control - then in Properties window set the "Locked" property to True. This will stop you being able to move or resize the control whilst still being able to change its properties. Is this what you were trying to do ???
|
|
|
|
|
infact this is not what i need,in this way(locking the control)users can find out that there is a control inside the parent control.pretend statusbar,when we add a panel to it ,just a panel shows inside the statusbar but we can not choose it.maybe i'm using the wrong way....is it possible that during design time controls draw a schema of their runtime ?
|
|
|
|
|
Hi all,
using C# code i have created a new user account (by using Directory Service Entry) because i need that a new user is created when i install my application so that my app can run as like that user.
The problem is that the new user accont appears on win xp start up and i don't want others users could see than the account exists.
So i'm searching if exists a property ( in ADS_USER_FLAG_ENUM for setting user properties) can be adding in order to make hidden the user control created at the start up, after installation of my app!..but no result of my search!
Someone can help me and have got any suggestion to hide an user account using C#.NET code?
Thanks
Regards
|
|
|
|
|
Sounds strange.
I'd say, if some Software creates a new Account on my computer, i'd want to know.
Cheers
Sebs
|
|
|
|
|
The code is about like this,
and i think that there would be a property for the account to hide it when login after reboot the machine:
///
/// account property user flags
///
const int ADS_UF_PASSWD_CANT_CHANGE = 0x40;
const int ADS_UF_NORMAL_ACCOUNT = 0x200;
const int ADS_UF_DONT_EXPIRE_PASSWD = 0x10000;
// add the user
DirectoryEntry account = root.Children.Add(AccountName, "user");
account.Invoke("SetPassword", new object[] {pw} );
account.Invoke("Put", new object[] {"Description", "Built-in account for my
Application"});
// set a few properties
int userfalgs = EXPIRE_PASSWD|ADS_UF_NORMAL_ACCOUNT|ADS_UF_PASSWD_CANT_CHANGE;
account.Properties["UserFlags"].Add(userfalgs);
account.CommitChanges();
|
|
|
|
|
Yeah, sounds very strange!
Why does your application need it's own account? Usually, the only time this ever needs to happen is if your application is running as a service...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Infact, suppose that the application must run as a service and i need to do this
|
|
|
|
|
//vc++ code:
ZeroMemory( &SPTWB, sizeof( SCSI_PASS_THROUGH_WITH_BUFFERS ) );
How to do this in c#? Or there is another function to do the same work in C#?
|
|
|
|
|
|
Hi!Nair,
Thank you very much for your kindness help.
But tonight I have to work off. So,see you next day.
see u tomorrow!
Good luck!
momer
|
|
|
|
|
I don’t think you can do something like this with managed code. The concept of managed code enforces that allocated memory is all defaulted to a logical default value (like null, zero, false etc) and secondly you can not access memory beyond the bounds of your variable.
With unmanaged code, yes, you should be able to do this.
Salil Khedkar [^]
|
|
|
|
|
Hi, i've got this form which connects to database during form load. i'm using relative path connection.however, after i convert this form to a userControl, i can't add this userControl. it says that the program can't locate my database in this address: C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\myDataBase.mdb. But i did not do my work in that address!! so why would it look for my database there? But if i change my connection to a absolute path, it works. is it possible i remain using a relative path while using userControl.
chris
|
|
|
|
|
The problem you have is that your using relative paths! Don't ever do this! Your assuming that the current directory is the one that the application is started from. THis is almost never the case! Instead, build an absolute path to your database using the Path.Combine method and the Application.StartupPath property:
using System.IO;
.
.
string absDBPath = Path.Combine( Application.StartupPath, "mydatabase.mdb" );
Also, it's very bad practice to have an application hold open a connection to a database, or any other resource for that matter, for the life of the app or control. When using expensive and scarce resources, such as database connections, ALWAYS open the connection as late as possible, do your database work, then close and release the connection as early as possible. Holding open a connection to the database wastes money and memory on the server. Since your application spends 98% of its life idling, you're hogging a connection license and memory on the server and doing nothing with it!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi, sorry i think you made a mistake. the connection that your talking about is relative path which i'm using. this is my coding:
OleDbConnection conn = new System.Data.OleDb.OleDbConnection(); conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;" +<br />
@"Data source = "+Application.StartupPath +@"\myDatabase.mdb";
the current directory i'm working in is (C:\Documents and Settings\020670F\My Documents\020670F\FYP backup\SingaporeCrusieCentre\bin\Debug\myDataBase)
as i've mention earlier, after i convert my form to a userControl, i can't add the userControl i've created. it says that it cant locate my database in (C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\myDatabase). i'm confused because i did not do my project in that directory. it works after i use a absolute path connection. Please Help. Thanks
Chris
|
|
|
|
|
nuttynibbles1984 wrote:
the connection that your talking about is relative path
No, it's not. Application.StartupPath returns a completely qualified absolute path, starting with a drive letter. A relative path would look something like "..\..\subDir1\subDir2\myDatabase.mdb".
Hmmm...I don't know what you did. When I used Application.StartupPath , I got the path to the bin folder in my project folder. Something like this:
"C:\Documents and Settings\[userID]\My Documents\Visual Studio Projects\RegistryAccess\bin"
This worked in either a Windows Forms project or in a Control Library project. In the later case, it always returns the path to the application that is hosting the control.
BTW: What do you mena you "converted" your app from a Windows Forms project to a Control project? What did you do?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
there's two way to use userControl. 1) to add a new project and select add user Control. 2) if you have create a form and did some coding, you can change this form to a user control by changing System.Windows.Forms.Form to System.Windows.Forms.UserControl at the very top just after the namespace.
namespace Form1<br />
{<br />
<br />
public class Form1 : System.Windows.Forms.UserControl
{<br />
}<br />
}
anyway do you want me to send a sample program to you and mayb you can see what i mean.??
Chris
|
|
|
|
|
i am planning for the development of a peice of software designed to use a dbms, thing is, i don't want to lock it down to any specific dbms, so the idea was that i would design an interface, and provide some implementations. The idea is that, out of the box, one can easily select a variety a dbms to use, and the option is there for developers to write their own implementations.
now, how can i enumerate and allow selecting of interface implementations? there must be a way?
|
|
|
|
|
Hi,
im doing a log file parser in c#. i have finished. but when come to the performance it is very slow to handle 40,000 lines in a log file. how can i improve the performance.
im using a string manager class which adds the string to the hashtable if the string is not there. otherwise it returns the already existing string index. in the hashtable, i have used int value as a key and value as a StringBuilder.
when it searches the hashtable for a specific string using ContainsValue it takes the most of the time.
any solutions to improve this.
thank u.
|
|
|
|
|
Here you need to manipulate with lot of string values. String in immutable in nature . In this sort of senario StringBuilder class is ideal . Please check the properties and Methods of StringBuilder class which avilable in System.Text namespace and all members of this class are self explanatory in nature(MSDN). And apply little logic to achive your result.;)
Sreejith Nair
[ My Articles ]
|
|
|
|
|
hi,
Thank u Mr.Nair.
yes i have done it. now im using a hashtable and it is faster. but there is one more problem. serialization takes much time than parsing the file.
after parsing all the files, i add all the files in an ArrayList and then i gave that arraylist to serialize. i used the serialization at the end.
help me out.
thank u.
|
|
|
|
|
Insted of ArryList Try to use SortedList and compare the performance.
Sreejith Nair
[ My Articles ]
|
|
|
|