|
hai all,
I am using one context menu in parent form, whereever i am clicking on the form ,the context menu is appearing, now, my problem is i am adding a child form in Mdi, child form contains one datagrid, if i am clicking on column header of datagrid ,a new context menu should display not the one in the parent form context menu. ya its coming,but again i am clicking whereever in the form(except coumn header) in child form, the parent form context menu is not appering, please help me how to do, i am new to programming field
thanks in advance..
faizal
ksf
|
|
|
|
|
faiznasi wrote: the parent form context menu is not appering, please help me how to do, i am new to programming field
I am not getting how you are expecting parent context menu to appear when clicking on child form ?
|
|
|
|
|
hai navaneeth,
I created one context menu and added into a parent from(parentMdi) properties, after that i am adding one child form to that parent mdi page. (the child is loaded into parent form) where ever i am clicking the parent form context menu is apperring, but i need to hide the context menu if i am clicking datagrid column header of child form(for that, in mouse down evnt of datagrid in child form, i wrote a code, if it is column header ,i am making a static variable to 1 and pass that variable to parent child and making as invissble, ya its working) one i hitted in datagrid column header, the parent contextmenu is disappearing, now my problem is if i am again clicking on the form(the parent form context menu should appear) its not appering, i think now u r understod my problem,, please suggest me how to do
thanks and regards
faizal
ksf
|
|
|
|
|
override the context menu to be display in the child form or set it to null if u don't want to display anything
|
|
|
|
|
How to write an error in event using Event Log with date and time in C# window applications
|
|
|
|
|
you can use Filestream class to write into a file and simply call that function in
try
{
//your code
}
catch {
//call logfunction here
}
so if any error occurs it will be logged into the file.
Regards.
Tasleem Arif
|
|
|
|
|
|
Why use a preprocessor variable instead of a normal one
Gaurav
|
|
|
|
|
G.K.M. wrote: Why use a preprocessor variable instead of a normal one
I guess it is executed in the compile time
|
|
|
|
|
A what? This is the C# forum.
|
|
|
|
|
How to Validate an XML Document by Using DTD, XDR in c# window applications
suman.c
|
|
|
|
|
|
I have a windows app connecting to a webservice. In some situation(s) (haven't narrowed it down enough), I get the following exception:
The underlying connection was closed: The connection was closed unexpectedly.
Please help.......
Regards
Pankaj Joshi
|
|
|
|
|
hi all
I have a .net web application. I need to copy a file present on the web server machine to a remote machine on the network. how is it possible? i tried using CopyTo(); methode. but not working. somebody told me that copy file is not possible in web application. but i think download file is possible only for website. then how is it done?
please help me.
|
|
|
|
|
P_Elza wrote: i think download file is possible only for website. then how is it done?
Use WebClient class and WebClient.DownLoadFile() method
|
|
|
|
|
The MSDN example at:
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_cscomp/html/ba881e38-2abf-4a5f-b9e6-28d26a5bd235.htm
Shows the following code and says it will throw an "Error Message: Use of possibly unassigned field 'field'; A field in a structure was used without first being initialized."
public struct error<br />
{<br />
public int i;<br />
}<br />
<br />
public class MyClass<br />
{<br />
public static void Main()<br />
{<br />
error e;<br />
System.Console.WriteLine( e.i );
}<br />
}
But it's my understanding that the compiler generated constructor for a struct automatically intializes the fields to zero, false, or null.
Since the struct in the example has no explicit constructor, why isn't i being initialized to zero?
|
|
|
|
|
Hi,
it is not related to your struct, the same is true for all value types, example:
public class MyClass {
public static void Main() {
int e;
System.Console.WriteLine( e );
}
}
i.e. local variables need explicit initialization.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
That confuses me some. I want my struct to have usable default values. But you are saying that any code which uses my struct does not have access to values that I set in it's constructor (or that the compiler sets for me)?
|
|
|
|
|
Hi,
JoeRip wrote: That confuses me some. I want my struct to have usable default values.
To test struct initialization you had to use a class member "error", not a local variable.
The compiler insists local variables are initialized before they are used.
A class member "error" will have all its members initialized to zero/null/Nothing...
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
"
this default constructor is only invoked if the struct is instantiated with new.
"
|
|
|
|
|
AH! That's my error, thanks. For a minute there I thought I was fundamentally misunderstanding what structs were for.
|
|
|
|
|
I just found out myself. I spent most of the day Sunday wrestling with a struct .
It should be possible to define a default constructor for struct s dagnabit!
|
|
|
|
|
Hi experts,
(I hope I didn't post my question in the wrong category of the forum)
I am using in C#, Asp.Net, SQL Server for my project.
I have a situation whereby I need to update a primary key.
In my table, I have these columns:
[U]proj_id[/U], emp_name, emp_email
I have the following method
public static void updatePID(String newpid,String oldpid)
{
SqlConnection conn = new SqlConnection(connString);
SqlCommand comm = new SqlCommand("Update table_name set proj_id = newpid where proj_id = oldpid");
conn.Open();
comm.Connection = conn;
comm.Parameters.AddWithValue("@projectid", newpid);
comm.Parameters.AddWithValue("@projectid", oldpid);
comm.ExecuteNonQuery();
conn.Close();
}
I have a problem with the following two statements.
comm.Parameters.AddWithValue("@projectid", newpid);
comm.Parameters.AddWithValue("@projectid", oldpid);
My connection with the database and the variables "newpid" and "oldpid" values are correct.
May I know if there is any other methods to update a primary using the old primary key? Thank You in Advance.
serene
|
|
|
|
|
Ummm... how about:
...
SqlCommand comm = new SqlCommand("Update table_name set proj_id = @newpid where proj_id = @oldpid");
...
comm.Parameters.AddWithValue("@newpid", newpid);
comm.Parameters.AddWithValue("@oldpid", oldpid);
...
|
|
|
|
|
Thanks but it's still working. There isn't any update in the database although there is no compliation or runtime error.
Er.... I guess there is something wrong with my logic? Please help..
protected void Page_Load(object sender, EventArgs e)
{
// It did display the first(old) project id into the textbox.
String projectID = (String)Session["projId"];
txtProjId.Text = projectID;
}
protected void btnConfirm_Click(object sender, EventArgs e)
{
//get project id
String newpid = txtProjId.Text;
String oldpid = (String)Session["projId"];
ProjectDAO.updatePID(newpid, oldpid);
}
I wanted to display the project Id that the user has first entered. It was saved in the database.
Then the system allows them to change the project Id at another page.
Erm.. and the only reason I can think of it that "String newpid = txtProjId.Text; " values is the old value instead.
Any idea how to make this work?
Thanks. Sorry for the trouble.
serene
|
|
|
|