|
Create a new constructor for Form2 with a form1 parameter
Form2(Form1 frm1)
{
}
when opening form2, hide form1 and when closing form2 show form1
|
|
|
|
|
thanks a lot
i will try this as soon as possible
Have a nice Day
|
|
|
|
|
Good
|
|
|
|
|
WORKS GREAT
Have a nice Day
|
|
|
|
|
Hello All,
I have 2 text boxes for User Name and Password. After I enter User Name and Password and try to validate. The below code throws the error "Input String is not in correct format" for password field.
string sSQL = "SELECT USR_Password FROM Users WHERE USR_LogonID = '" + userName + "'";
cmd = new OdbcCommand(sSQL, con);
cmd.Parameters.Add( "@userName", OdbcType.NVarChar, 8 );
cmd.Parameters["@userName"].Value = userName;
// Execute command and fetch pwd field into lookupPassword string.
lookupPassword = (string) cmd.ExecuteScalar();
lookupPassword = System.Convert.ToString(lookupPassword).Trim();
Could anyone please tell me what is wrong with the code...
Thanks in advance
|
|
|
|
|
Your SQL string itself has the complete query. You need to remove the cmd.Parameters.Add statement or change the SQL string to "SELECT USR_Password FROM Users WHERE USR_LogonID = @userName" .
The second approach is the recommended one, as it helps prevent SQL injection attacks and enclosing strings in single quotes..
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
How to Sort the array in descending order
Dinesh
|
|
|
|
|
what type of values?
numerical or alphabetical?
It's Never too late to Start or to try again
|
|
|
|
|
|
Hi everyone
Is there any way to check a queue's status to see if any message has been written in? Sort of an alert message that a new message has been inputted , but with out taking the actual message off from the queue.
Thanks
Luke
Its never late
|
|
|
|
|
I have new format for get a image from CD/DVD(same .nrg for nero).
but I want a drive for test CD/DVD image(C# or VC 7.0).
CAN YOU HELP ME?
|
|
|
|
|
Hi,
I downloaded the new starter kits for Visual Web Developer and they end in .vsi, and I don't seem to have a program that recognises this extension. Can someone please advise where I can download this program? And is it free?
Cheers.
|
|
|
|
|
hi
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!
|
|
|
|
|
Hi!
I'm quite new to this programming business but i'l try my best to help...
Logically I think it would be better to set the link first so that you can do the conditions by means of trial and error.
Though possibly your target output cannot still be met you'd still have the luxury of knowing that the link button works. So fitering out the error wouldn't be much of a problem...
Hope I was of some help!
Kampai!
|
|
|
|
|
ok. sure i'll do juz dat. den i'll c how it goes from there.. thz =)
|
|
|
|
|
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
|
|
|
|