|
OK, ok,
But why are you posting same answere twice?
All the best,
Martin
|
|
|
|
|
First i post a message..my post doesn't show in forum then i posted it again, then i get my new and old message show
Regard,
TCim
|
|
|
|
|
As Martin stated, you should use the ShowDialog method. Then, depending on the DialogResult from the form, you would reload the data (as it doesn't make sense to reload the data if you haven't actually done the save).
Suppose that you have a form called OptionsDialog which you are going to use to add some options into a program and that the details will be saved to the database when the user clicks OK. In this form, set the DialogResult of the OK button to OK.
In your parent form, you would call it with something like this:
private void AddOptions()
{
using (OptionsDialog dlg = new OptionsDialog())
{
if (dlg.ShowDialog(this) == DialogResult.OK)
{
ReloadOptions();
}
}
} I hope that this helps.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Good. My 5. But please make me clear on this
Pete O`Hanlon wrote: using (OptionsDialog dlg = new OptionsDialog())
What is this statement ?
How about using delegates to get the same result ? is it a good practice ?
|
|
|
|
|
N a v a n e e t h wrote: Pete O`Hanlon wrote:
using (OptionsDialog dlg = new OptionsDialog())
What is this statement ?
A "using"-block will Dispose and Close the form automatically after code block has finished!
So you don't have to worry for that.
N a v a n e e t h wrote: How about using delegates to get the same result ? is it a good practice ?
It depends of the problem and the way something has to be solfed.
In this case it would be neccesary if the programmer says, that ShowDialog should not be used (maybe because of aditional parallel interaction with an other form).
Than you would have to use Show(), and Form provides the delegates for that (Close and Closing)
All the best,
Martin
|
|
|
|
|
The using statement here means that I don't have to remember to call the Dispose() method on the form. Another way to do this would be:
OptionsDialog dlg = new OptionsDialog()
try
{
if (dlg.ShowDialog() == DialogResult.OK)
{
ReloadData();
}
}
finally
{
dlg.Dispose();
} The C# team provided the using command as a shortcut so that any type that implemented IDisposable could be automatically disposed. This feature was added to VB.NET in .NET2.
Using delegates is also a good way to do this, especially if you don't want to go the ShowDialog route. Suppose that you have a modeless dialog, delegates are a very good way to pass the information back.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Thanks pete for making concept clear.
|
|
|
|
|
No problems, I'm glad to help.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Thanks,
I hope it will work fine with that problem,
I'll let you know after applying it.
Thanks again
Nisha S.
|
|
|
|
|
Hi techies,
may i get a help regarding how to "Changing the Advertisement in a AdRotator control by setting a specific interval of time...?"
thanx & regards
Ramu Annamalai
|
|
|
|
|
Don't Cross Post in Multiple Forums.
SSK.
|
|
|
|
|
Vri SSK wrote: Don't Cross Post in Multiple Forums.
Didn't you do same, by telling him this in both forums?
All the best,
Martin
|
|
|
|
|
How to create a textbox in c++..? I want to create 3 textbox and a button, if u insert values to the 2 textbox(suppose 1st textbox "2" and 2nd textbox "4")and if click the button third textbox should display the reslut(2+4=6) Plse reply..
|
|
|
|
|
Post it in the Correct Forum.
SSK.
|
|
|
|
|
I'm sorry garga1,
this is c# forum, if u want to ask anything in c++ u should go to c++ forum
int a = Convert.ToInt32(Textbox1.Text);
int b = Convert.ToInt32(Textbox2.Text);
int c = a + b;
TextBox3.Text = c;
Regard,
TCim
|
|
|
|
|
Hi There,
I have to open Outlook window, rather specifically some particular window with in outlook using C#. For example, if a user of my application has to add a new task in the tasks list, or setup a new appointment, I want to allow my users to click on a button on Windows Form and access that particular window i.e. Add New Task Window, Add New Appointment Window etc.
I can do this using Outlook Object Library as well, but in my particular case I have to do this using the actual outlook windows. Well, if I'll be able to do that first, then i'll definitly show a list of the items in my windows form and then let the user click on a particular item and then edit in some outlook editor window.
Any help on this would be really appreciated.
Best Regards,
Shahzad
|
|
|
|
|
these r some of the links which will solve ur problem
http://weblogs.asp.net/cumpsd/articles/89697.aspx
http://dotnetjunkies.com/Tutorial/2E1EEEAF-C78A-4A38-A830-AC204B12DF83.dcik ----> specific to ur case
With Regards
Amjath
|
|
|
|
|
Thanks very much, Amjath, for the reply.
But, infact, I was looking something to open a specific window of the Outlook. As we can open Outlook itself by using Process class in the Diagnostics namespace. It just opens the main Outlook window, but I was looking for something which can directly open a particular window like Add New Task, Or if I select a particular task from a list it can open the details in the task editor window of the outlook.
The articles you have mentioned can help me do the stuff by coding, but I don't wanna code, I just wanna go to the specific window.
Regards,
Shahzad
|
|
|
|
|
hai all ,
in database i used only one database for empid (int),username(varchar),password(varchar),status(int),usertype(varchar)
what ever i will assign that values are not inserted into database
iam getting value in text but iam not getting in query.
please see my code
<pre>
Label1 .Text =""; //for displaying in design phase
Label2 .Text ="String.Empty;";
Label3 .Text ="String.Empty";
Label4 .Text ="";
Label5 .Text ="String.Empty";
TextBox1 .Text ="empid"; //for entering
TextBox2 .Text ="username";
TextBox3 .Text ="password";
DropDownList1.DataValueField =""; //status 1 and 2
DropDownList2 .DataValueField ="usertype"; //for normal user and admin
SqlConnection con=new SqlConnection ("uid=sa;password=sa123;database=usermanagement;server=c113");
SqlCommand cmd=new SqlCommand ("insert into tbl_user_management (empid,username,password,status,usertype) values('"+ TextBox1.Text +"','"+ TextBox2.Text +"','"+ TextBox3.Text +"','"+ DropDownList1 .DataValueField +"','"+ DropDownList2 .DataValueField +"')",con);
//SqlDataReader dr;
con.Open ();
//status = Convert.ToInt32(dr["status"]);
cmd.ExecuteNonQuery();
con.Close ();
srinivas
|
|
|
|
|
srinivassam wrote: "insert into tbl_user_management (empid,username,password,status,usertype) values('"+ TextBox1.Text +"','"+ TextBox2.Text +"','"+ TextBox3.Text +"','"+ DropDownList1 .DataValueField +"','"+ DropDownList2 .DataValueField +"')"
Assign this to a string variable and print that string variable before you execute. Paste the query in query analyzer and you will get the problem. Warning, Using this method you are too close to SQL Injection Attacks. Better read Colin Angus Mckay's SQL Injection Attacks[^] article and change your method.
|
|
|
|
|
<code>("insert into tbl_user_management (empid,username,password,status,usertype) values('"+ TextBox1.Text +"','"+ TextBox2.Text +"','"+ TextBox3.Text +"','"+ DropDownList1 .DataValueField +"','"+ DropDownList2 .DataValueField +"')</code>
Try not to do any hardcode..use stored procedure using parameter to avoid SQLInjection..i think u got an error in that code because the empid type is in integer but u inserted a string value to it ( TextBox1 .Text ="empid"; )..try to convert TextBox1.Text to integer format and make sure TextBoxt1.text is a numeric and do this on your SQLcommand(...values('"+Convert.ToInt32(TextBox1.Text) +"',etc...)
regard,
TCim
|
|
|
|
|
hi
How cani access to another computer over interner network?
i want to use it to made a chatroom like yahoomessenger!
Thanks for your help.
|
|
|
|
|
ali_reza64 wrote: How cani access to another computer over interner network?
Using IP you can send data over network
ali_reza64 wrote: i want to use it to made a chatroom like yahoomessenger!
First you need to write a server application that can connect clients. Server should be multithreaded to accept multiple clients. You can use TCP connection. When one client is sending request to chat with another client, you need to establish a dedicated connection between those two machines and communicate each other.
|
|
|
|
|
Hi all,
I m try to connect crystal report with database(Access) but i have no idea about it plz help if you can proide code. or any logic.
thanks in advance,
Nikesh Yadav
CSS Infotech
Gurgaon,
Haryana(India).
|
|
|
|
|
Hi Nikesh,
To do that you have to specify the logon details. Plase refer the following link, that's for connecting to SQL Server.
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1826353&SiteID=1
|
|
|
|