|
private void button1_Click(object sender, System.EventArgs e)<br />
{<br />
if(Validate(textBox1.Text))<br />
{<br />
Form2 frm =new Form2();<br />
frm.Show();<br />
}<br />
else<br />
{<br />
}<br />
<br />
}<br />
private bool Validate(string Val)<br />
{<br />
if(Val!="")<br />
{<br />
if(Val.Length==9||Val.Length==12)<br />
return true;<br />
else<br />
return false;<br />
}<br />
else<br />
return false;<br />
}
Sreejith Nair
[ My Articles ]
|
|
|
|
|
thanks! i think that's v helpful =)
But wat do i do to make sure that the user keys in a fixed/standard letter followed by 7 digits n any 1 letter if the person is entering a value length of 9? an example is x1234567y
|
|
|
|
|
In .NET we have value type called Char Structure . You can use this to identify whether the given character belongs to your expected type (Digits,Letter, Number,Punctuations etc) or not.
You call requirded methods of that structure on KeyPress event of your respective control.
Eg:
<br />
private void CtextThree_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)<br />
{<br />
if(Char.IsDigit(e.KeyChar))
e.Handled=false;<br />
else<br />
e.Handled=true;<br />
<br />
}<br />
This is a sample exmaple to come out with a solution. Hope this will surve your purpose.
Sreejith Nair
[ My Articles ]
|
|
|
|
|
Please leave out the l33t speak. We're all adults here.
using System.Beer;
|
|
|
|
|
sorry but i do not understand wat u mean by l33t speak... can u explain..
|
|
|
|
|
|
hello
i have problem regarding arraylist in c#. i have put numbber of objects of a class in a arraylist object after that at run time i creat an object and i want to compare with that object with stored array list object please tell how i will do this task.
like arraylist store these objects and object have 3 parameters and the object which i create at run time also a object of same class and have same number of parameters i want result as the basis of all parameters matching.
if ( temp == 0)
{
moves obj1 = new moves(s,d,piece);
myal.Add(obj1);
//Console.WriteLine(myal);
}
waiting early reply. ok thanks
|
|
|
|
|
Hi,
First cast the arraylist your object array
say student objects
Student [] studArr = (Student[])arrList.toArray(typeof(Student));
foreach(student stud in studArr)
{
//do search
}
regards.
|
|
|
|
|
ok that becomes arrayof objects but a object which i want to search is not an array element its just a runtime object that will pass to function and that function will search it in arraylist.
|
|
|
|
|
Use the IndexOf method to get the index of the object in the arraylist.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
hi all,
1) how do i create a link (say when i click on a button in form 1, it will display form 2).. im not sure whether u call that linking or is there a term for this kind of action? any thing for me to read up?
2) is there a way to tell the compiler which form i want to run and run that selected form only? cos rite now i've a few forms but i haven link them up. i wld like to just run form 2 to test my app. izzit ok to run it dis way, that is i dont link up all the forms yet n only aft i noe all my forms are workin ok den i link them all up??
by the way, im using visual studio .net 2003..
thz a lot ppl! =)
|
|
|
|
|
A link? kind o a web-like hyperlink? There'a a LinkLabel control in your toolbox, and it has a LinkClicked event that is fired when the user clicks on it. You can visit a web page, open a form or whatever.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Wait... do you want to open a second form from a button in form 1? Double click the button in the designer and you'll get an empty handler for the Click event (named something like button1_Click ). Write this in it:
Form2 form = new Form2();
form.ShowDialog(this); Good luck!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
form2 frm2 = new form2();
frm2.Show();
|
|
|
|
|
ok i will try that out.. but as im new to visual studio .net 2003 n c# language, pls pardon me for the "dumb" questions i ask.. haha..
well, do i've to finish creating a form 2 before i can actually go about to do the linking of the button in form 1 to display/direct to form 2?
also, rite now im lost in my project.. i've to set some conditions to the program. say i got to enter a string of 9 letters + numbers >> x1234567y OR 12 numbers >> 111111111111 before hitting the ok button (this button will direct me to another form if i keyed in correctly). the system will do a pop-up box telling u if u had keyed in an invalid no, that is not 9 letters + numbers nor 12 numbers.
im thinking, wat should i do first? to set the conditions or link the button in form 1 to form 2 first?
thz so much!
|
|
|
|
|
Hello Friends,
I have to write Nunit Test cases for a console EXE which is written in C#.
In NUnit test class I can take reference of a targeted DLL or COM object. But I am not able to get a reference of a EXE. Please guide me how to get a reference of a EXE in C# class. How can I use methods and properties of that EXE in C# class?
Waiting for your reply.
Sachin
Sachin Gedam
(Software Engg.)
Pune India
|
|
|
|
|
Hello Sachin,
It is not necessory to make another project for NUnit. You can include a TestFixture class inside your console exe project, compile it and load the exe in NUnit GUI. It should execute the test cases for the console exe.
Cheers. HTH
Maqsood Ahmed [MCP,C# SQL Server]
Kolachi Advanced Technologies
http://www.kolachi.net
|
|
|
|
|
Dear Maqsood,
Yah normally, in earlier project we did the same thing.
We used to write a test case in same assembly. But here customer wants to maintain Test Project on other location. Even he want the different namespace for the same.
And the problem start from here, I am not able to take reference of EXE in my NUnit Project, so that I can use the methods and property of that EXE.
Hope you could get my problem.
Sachin Gedam
(Software Engg.)
Pune India
|
|
|
|
|
Hi all,
I want to highlight my C# windows application on the taskbar.
Thanks..
|
|
|
|
|
i have this connectionstring:
MySQLConnection conn = new MySQLConnection(new MySQLConnectionString("xxx.xxx.xx.xxx","rfid","root","")AsString);
i tried connecting to the ip above but it returned with this error:
Host xxx.xxx.xxx.xxx is not allowed to connect to this MySQL server
but the connectionstring works on a localhost, may i know what's wrong?
----------------------------------------------------------------------
BingLin
|
|
|
|
|
Perhaps the MySQL server does not allow the client from the ip class you supply to connect to it, and if is so the problem may be from the server...
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|
|
i understand that the server is not giving permission for the client to connect to it, what should i do to enable the connection?
i've tried entering this statement:
mysql> GRANT select,insert,update,delete,create,drop on DB.* T0 DB_USERNAME@HOST IDENTIFIED BY 'DB_PASSWORD';
i have replaced DB with my database name testdb
for DB_USERNAME@HOST, what should i replace to? is it root@localhost which is mine?
i've read that someone got the same error as me, and he used this statement to help him solve the problem, hope to be helped to solve this error
thanks!
|
|
|
|
|
binglin wrote:
DB_USERNAME@HOST, what should i replace to? is it root@localhost which is mine?
DB_USERNAME@HOST should be The_User_With_Which_You_Identify_Onto_The _Server@Your_Computer_Name
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|
|
BingLin:
I think MySQL has a table in its mySQL database comprising of IP Addresses which are entrusted with privileges to connect besides username/password.
By default, you have localhost. I think you need to add IP too.
Deepak Kumar Vasudevan
Personal Web: http://vdeepakkumar.netfirms.com/
I Blog At: http://deepak.blogdrive.com/
|
|
|
|
|
I am writing a WindowsForm app that sends a smtp e-mail. When the app attempts to send the message, it fails. A permissions error occured. The user knows of the e-mail being sent, and doesn't care, how do I let the program know?
|
|
|
|