|
Thanks for the information
I have tried this code, but when I build it I get this error the private method I have assigned with. I thnk I have done something wrong
It says "Method name expected"
This is the code I used for form 1
private void btnNewPost_Click(object sender, EventArgs e)
{
Forms.frmAddCategory addcats = new frmAddCategory();
addcats.Refresher += new Forms.frmAddCategory.refreshcat(this.comboRefresh("newPost"));
addcats.ShowDialog();
}
comboRefresh(string blah)
{
}
and this is for the form 2
public partial class frmAddCategory : Form
{
public delegate void refreshcat();
public refreshcat Refresher;
private void frmAddCategory_FormClosed(object sender, FormClosedEventArgs e)
{
Refresher();
}
|
|
|
|
|
Deques wrote: addcats.Refresher += new Forms.frmAddCategory.refreshcat(this.comboRefresh("newPost"));
addcats.Refresher += new Forms.frmAddCategory.refreshcat(this.comboRefresh);
If your comboRefresh() method takes string parameter, you should change the delegate like
Deques wrote: public delegate void refreshcat();
public delegate void refreshcat(string str);
Deques wrote: private void frmAddCategory_FormClosed(object sender, FormClosedEventArgs e)
{
Refresher();
}
private void frmAddCategory_FormClosed(object sender, FormClosedEventArgs e)
{
Refresher("string to be passed");
}
|
|
|
|
|
Thanks. It works now
Only thing that the combobox doesnt update directly sometimes. But thats another problem
|
|
|
|
|
Welcome. Glad to hear that it helped
|
|
|
|
|
implement delegate and raise event.
the problem in your code it's making the new copy of your form and you need to perform some action on your previously opened form
|
|
|
|
|
Hi all, I am newbie to C#
I would like to implement a function where the variable passed
should not be changed during execution. In C++ I used void foo( const int a ).
What I can do in C# in order to ensure that my variable is not touched
If i use void foo(const obj MyObj) I have an error. Is the only way to pass
an already const member?
Kind Regards
ManuStone
|
|
|
|
|
Hi
Most Parameters are passed as values to a function so if you call
void foo(int param)
{
param = 2;
}
void main()
{
int i = 1;
foo(i);
Console.WriteLine(i);
}
the output will still be 1.
the only problem you could have would be, if you pass an object and inside your method, a property of that object is changed. this will affect the original object if it's a reference-type (class) for a struct no changes are applied to the original.
greets
m@u
|
|
|
|
|
m@u wrote: Most Parameters are passed as values to a function
No, just value types.
m@u wrote: the only problem you could have would be, if you pass an object and inside your method, a property of that object is changed
You mean mutable reference types rather than objects, ints and doubles are objects too. You do clarify that in the next sentence but it could be read wrongly.
|
|
|
|
|
as far i know, the passed parameters will not change unless they indicated as ref or out
just use your method
foo(myObj);
I Wish the Life Had CTRL-Z
|
|
|
|
|
subai wrote: as far i know, the passed parameters will not change unless they indicated as ref or out
Incorrect. The passed parameters will not change if they are immutable (e.g. a string) or if they are value types (e.g. int, double, DataTime)
If the types are reference types that are mutable (and the vast majority are) then there is every possibility that the object passed as a parameter can itself change. But you cannot change it to another object.
|
|
|
|
|
thank you very much for telling me my wrong thought
I Wish the Life Had CTRL-Z
|
|
|
|
|
Dear All,
Warm Greetings!!!
I want to List all the domains in my network.
How can I perform this?
Can anyone help me to get this done?
Thanks a lot in advance.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
Where can i get open source code for Media RSS 2.0 parser?
I want the output to be generated in XML format by passing url of type Media RSS 2.0.
For this where can i get open source code?
Rajshri
|
|
|
|
|
|
Hai iam working with list and i have added items to list and how can i find whether the items r added to list or not using windows applications using c# and how can i display the items in list in windows applications plz any one help me in this problem
|
|
|
|
|
if it is a listView control or it's a collection type in both cases u can check by calling the "Contains" function of both classes. This function returns true or false.
and to display those just add them list.items.add(item)
|
|
|
|
|
hi
i'm looking for a hash algorithm that produces smallest result, the only one i used before was MD5 but i'm looking something shorter & easier to read by user.
any Idea?
thx in advance
I Wish the Life Had CTRL-Z
|
|
|
|
|
What about CRC? I think that produces a smaller result.
My current favourite word is: PIE!
I have changed my name to my regular internet alias. But don't let the 'Genius' part fool you, you don't know what 'SK' stands for.
-The Undefeated
|
|
|
|
|
thx
I Wish the Life Had CTRL-Z
|
|
|
|
|
how to find my Queston that post befre?
|
|
|
|
|
How do you find anything else you're looking for? You search for it. That's what the "search comments" function is for. What did you think it would do?
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
|
Through the arcane art of searching...
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hi, I have a requirement to implement online test like Brainbench, Geekinterviews.com etc.
I am new to this topic? What is the best way to implement this?
what are the steps i have to take to approach for this ?
What i have to consider before starting this?
Can any one help regarding this? Give suggestions, best way to do this.
It is better to not to reload a page, when the user clicks on next page?
with out using AJAx is it possible...?
Thanks in Advance
|
|
|
|
|
Hi to All,
I am trying to handle excel file in my application. Here I am trying to get a cell value in the text box on the event of button click. but whenever i run it shows exception that Access is denied..... my code is as follows....
private Excel.Application oXL=null;
private void Button1_Click(object sender, System.EventArgs e)
{
InitializeComponent();
oXL = new Excel.ApplicationClass();
oXL.Visible = true;
Excel.Workbook oWB = oXL.Workbooks.Open("D:\\Pravin\\October-07\\xls\\7starcare-October.xls",0,true,5,"","",true,Excel.XlPlatform.xlWindows,"\t",false, false, 0, true);
Excel.Sheets oSheet= oWB.Worksheets;
Excel.Worksheet oWS = (Excel.Worksheet)oSheet.get_Item(1);
TextBox1.Text= Convert.ToString(oWS.Cells.get_Item(1,1));
}
But whenever i run my application it shows exception as follws ....
------------------------------------------------------------------------------------------------
Access is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: Access is denied.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true">, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
----------------------------------------------------------------------------------------------------
how can i remove this problem?
Pravin
|
|
|
|