|
I am developing Login Control where the user can enter username and password. in the Username and password box i should restrict the user from entering Special Chars, and other invalid keys.
i know i can compare the the value in Keydown event using Keys.Keycode, but it is very ugly to put all the Spl char comparision like if(e.Keycode==Keys.Enter || etc..). Is there any function or way to Compare the key pressed is a spl. char or not.
Thanks and Regards
Srini
|
|
|
|
|
Try MaskedTextBox!
But filtering using KeyDown is still my preference.
-K
Jup
|
|
|
|
|
Think outside the box!!!!!
You have a group of keys that you want to have disallowed from entry in a textbox. So a simple solution to this would be something like this:
List<Key> invalidKeys = new List<Key>();
...
private void ThisForm_Load()
{
invalidKeys.Add(Keys.Enter);
invalidKeys.Add(Keys.Ctl);
...
}
...
if ( invalidKeys.Contains(e.Keycode) )
e.Handled = true;
-- modified at 9:49 Thursday 13th July, 2006
|
|
|
|
|
"frmAdmin" is a value of a string variable.
There is a Form class in that name too.
i get this string value during run time.
how can i instantiate a form of which the class name is the string value ?
supun
-- modified at 0:59 Thursday 13th July, 2006
|
|
|
|
|
Use Activator.CreateInstance() method:
Type formType = Type.GetType("MyNamespace.frmAdmin");
frmAdmin form = (frmAdmin)Activator.CreateInstance(formType);
form.Show();
This will work if frmAdmin is defined in the same assembly. Otherwise use CreateInstance() with other parameters.
|
|
|
|
|
Thank you very much Andrew.
Supun
|
|
|
|
|
Hi all,
I have set an image to the Background of the form,
Now the image consists of a circle in blue color and the rest area is
black in color and i want this part to be transparent so that the form
looks Circular in shape.
I have gone thru http://www.codeproject.com/csharp/customforms.asp[^]
to do the above part.
But this link specifies that the VGA should be set to 1 bit,
I tried that and the form looked circular but the blue circle had some rough border,
i want the image to have a soft look and also that should work on 32 bit VGA
Thanks & Regards,
Pramod
|
|
|
|
|
Read this article.
Best regards, Alexey.
|
|
|
|
|
I want to create CHM Help file programmatically in C#. Basically I want to create documentation for my tables and stored procedures.
I did lot of searching on net but what I found is "HTML to CHM".
So What I think is,
1) I will create html files programmatically
2) Using some complier or some batch command or some thing, I will create CHM files
But some article points that you can use CHM file as a help in your .NET Application & some where it is written that System.Windows.Forms.Help can be used for it so there must be some way.
Can anyone give me some idea or some right direction?
Just I need fire, Then I will do it.
Nilesh Gambhava,
Life is NP-Complete so don't use Algorithm but use Heuristics
|
|
|
|
|
Hi,
To use .chm-file in your application as help file you can use HelpProvider class.
appHelp = new HelpProvider();
appHelp.HelpNamespace = "MyApplication.chm";
And then use SetHelpNavigator(), SetHelpKeyword(), SetHelpString() and other methods.
|
|
|
|
|
Thanks for quick response.
But I am not getting it.
I want to create new CHM file, I dont want to use CHM file as help
Nilesh
Nilesh Gambhava,
Life is NP-Complete so don't use Algorithm but use Heuristics
|
|
|
|
|
Like a 'critical system process'
What i really need is to stop people form closing a security app through the command line. So if theres any way to do that then, yeah.
|
|
|
|
|
try building a windows service that and set the stop property to false.
Do your best to be the best
|
|
|
|
|
Try API hooking.
Hook the TerminateProcess API.
You can use the madshi library.
www.madshi.net
Eran Aharonovich (eran.aharonovich@gmail.com )
Noviway
|
|
|
|
|
Hello,
I have a listView with the View property set to List. What I want to do is simply preventing the listView item from showing on serveral columns.
Like this:
1............2.............3
4............5.............6
I want them to appear as follow:
1
2
3
4
5
6
Please note: I don't want to add columns that will be visible to my user.
Please help. Thanks.
|
|
|
|
|
Hi,
No, you can't do this with the "List" View style. But you can set View = Details, add one column and set HeaderStyle = None if you don't want your users to see column header.
|
|
|
|
|
I can get the username, which will work most of the time, but as for example on my computer, the address is
C:\Documents and Settings\USER.OWNER-VS1SHD0MH8\My Documents\
because my computer is wierd.
But i need to know how to get to 'My Documents' every time.
|
|
|
|
|
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
Hope that helps
|
|
|
|
|
Oh yeah, thats good.
You learn somehting new every day. Its a miracle i didn't find this sooner, just think of the minutes i could have saved typing!!
|
|
|
|
|
i am building a software that will read from a csv file that is constantly been lock by an avaya smdr that keeps on writing to that file, but i want my program to be able to jus open the file and read it is this possible?? or once another program has lock a file for readAndWrite i cant even read from that file
kenny
|
|
|
|
|
|
thanks for the link i jus getting ready to leave the office but as soon as i reach home i going read it.
kenny
|
|
|
|
|
i reading through the example u sent me and i saw how it would allow you to read write to a integer value name resource but how would i use this in terms of reading from a text file
kenny
|
|
|
|
|
i am using this code to print a report but the problem comes when i pass parameters like Supplier_Id as i have done in this query the error comes like "Query engine Error and follows with the path.I am using this code.Well the problem doesn't comes with the query in which i have not passed parameters Pls help me to sort out this problem.Thanks Fahad.
try
{
int Supplier_Id=Convert.ToInt32(Supplier_Id_C.Text);
string s_p="sp_P_S_Rpt";
SqlConnection conn = Class_Connection.Make_Conn();
// SqlCommand command = new SqlCommand(s_p, conn);
// command.CommandType = CommandType.StoredProcedure;
// command.Parameters.Add("@Supplier_Id", SqlDbType.Int);
// command.Parameters["@Supplier_Id"].Value = Supplier_Id;
// SqlDataAdapter adapter = new SqlDataAdapter(command);
// DataSet ds = new DataSet();
// adapter.Fill(ds, "P_S");
//
// dataGrid1.DataSource=ds;
// dataGrid1.DataMember="P_S";
// P_R_Rpt obj = new P_R_Rpt();
// obj.SetDatabaseLogon("sa","sa","CDMA","Final_Project1_e");
// obj.SetDataSource(ds);
// crystalReportViewer1.ReportSource=obj;
// Cursor = System.Windows.Forms.Cursors.Default;
//reportDocument1.SetDatabaseLogon("sa","sa","CDMA","Final_Project1_e");
// reportDocument1.SetDataSource(ds);
// crystalReportViewer1.ReportSource = reportDocument1;
// Finalized.P_R_Rpt obj = new P_R_Rpt();
// obj.SetDatabaseLogon("sa","sa","CDMA","Final_Project1_e");
// reportDocument1.SetDataSource(ds);
// crystalReportViewer1.ReportSource = reportDocument1;
SqlCommand command = new SqlCommand(s_p, conn);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("@Supplier_Id", SqlDbType.Int);
command.Parameters["@Supplier_Id"].Value = Supplier_Id;
SqlDataAdapter adapter = new SqlDataAdapter("SELECT dbo.Supplier.Supplier_Name, dbo.P_Order.P_O_Date, dbo.P_Order.P_O_Serial_No, dbo.P_Order.P_O_Id FROM dbo.P_Order INNER JOIN dbo.P_O_Details ON dbo.P_Order.P_O_Id = dbo.P_O_Details.P_O_Id INNER JOIN dbo.Supplier ON dbo.P_O_Details.Supplier_Id = dbo.Supplier.Supplier_Id WHERE(dbo.P_O_Details.Supplier_Id = 2)","Data Source=CDMA;Database=Final_Project1_e;UID=sa;PASSWORD=sa");// = new SqlDataAdapter(command);
//P_R ds = new P_R();
//SqlDataAdapter adapter = new SqlDataAdapter(command);
DataSet ds = new DataSet();
adapter.Fill(ds,"P_R_Rpt1");
dataGrid1.DataSource=ds;
dataGrid1.DataMember = "P_R_Rpt1";
//P_R ds = new P_R();
// P_R_Rpt obj = new P_R_Rpt();
// obj.Load();
// obj.SetDataSource(ds);
P_R_Rpt1 obj = new P_R_Rpt1();
obj.SetDataSource(ds);
//obj.Load();
//sample_Rpt1.FilePath = @"C:\\Documents and Settings\\Fahad\\Desktop\\Finalized_With_Report\\Sample_Rpt.rpt";
obj.SetDatabaseLogon("sa","sa");//oRpt.SetDataSource (ds);
crystalReportViewer1.Visible=true;//CrystalReportViewer1.Visible=true;
crystalReportViewer1.DisplayGroupTree=false;
crystalReportViewer1.ReportSource = obj;//CrystalReportViewer1.ReportSource = oRpt;
//obj.Load();
//obj.Refresh();
// crystalReportViewer1.RefreshReport();//.RefreshReport()
// crystalReportViewer1.Refresh();//crystalReportViewer1.Refresh()
// crystalReportViewer1.Show();//crystalReportViewer1.Show()
}
catch(Exception ee)
{
MessageBox.Show(ee.Message);
}
|
|
|
|
|
Fahad Ali wrote as the subject line: Pls Help Me !!!
Just about every one here is looking for help. This is a useless subject line. You should use something more meaningful. For example "Query Engine Error" would be better.
|
|
|
|