|
I could, but haven't the time to put an example together. The MSDN documentation of the mentioned classes and methods contains many example and also continuative links. Take those as a starting point and experiment a bit. It's the best way to learn.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi,
I have a TreeView which will be used like the Visual Studio project explorer.
In Visual Studio, there are different context menu for different kind of items.
How can i do that?
As i can see, i can only use one context menu per control.
Thx,
Nuno
|
|
|
|
|
sinosoidal wrote: As i can see, i can only use one context menu per control.
There is no restriction like that. You can add multiple context menus and set them using the Form.ContextMenu property.
Also, you can access the current context menu using the ContextMenu property dynamically add or remove items from it.....
|
|
|
|
|
Ahh! I see! Cool
Thx,
Nuno
|
|
|
|
|
In a handler for the NodeMouseClick event of the TreeView, remove all the context menu items and add items that are specific for the particular node:
treeView.NodeMouseClick+=treeView_NodeMouseClick;
...
private void treeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
if((e.Button & System.Windows.Forms.MouseButtons.Right)!=0)
{
contextMenu.Items.Clear();
contextMenu.Items.Add(e.Node.Name + " 1");
contextMenu.Items.Add(e.Node.Name + " 2");
}
}
--Justin
Microsoft MVP, C#
|
|
|
|
|
For any given date, i need the start date of the week and end date of the week
in C#.Also i need to get the week number. How to get the week number.
For eg. 17/5/2007 - given date
week start date =?
week end date =?
I need the output as week start date = 15/5/2007
week end date = 21/5/2007
Revathi Raj
|
|
|
|
|
Hi,
DateTime inputDate=...;
DateTime outputDate=inputDate.AddDays(-inputDate.DayOfWeek);
gives you the last sunday at or before the input date.
|
|
|
|
|
Don't start a new thread for every post you write. Continue in the same thread.
Revathi Raj wrote: Also i need to get the week number.
Use the GetWeekOfYear method of the Calendar class.
---
single minded; short sighted; long gone;
|
|
|
|
|
I had problem with listbox in c#:
the problem is i have to listboxes the items in listbox1 moves to listbox2
and next button is pressed it moves to the nextpage if the items in listbox2 are moved back to listbox1 and next button is pressed it should show error message. upto here the functionality is working fine
the problem is there is a link below to delete the items in listbox1
once i deselect the items in listbox2 and then delete the items in listbox1
and press the nextbutton the message is not fired instead it is navigating to the next page.
I used javascript for moving the selected items from listbox1 to listbox2 and for deleting the items in listbox1
i require solution to this problem
any one please help me out in solving this problem
Thanks ®ards
giribabu
-- modified at 0:41 Friday 4th May, 2007
|
|
|
|
|
Please translate your request into English
Sorry, no code, no clear information, no screenshot = no answer.
Are you trying to do something like MS Access table creation wizard?
There are available, predefined columns on the left listbox, and you select,add them to the one on the right in this wizard. There are also, next, back like buttons. What do you want?
|
|
|
|
|
hi all,
i worked in ASP.Net and there i have default 6validators,
and i am happy to work with those,
and now when i wanna Restrict my controls, i didn't found any default validator property
please suggest me the approch, to validate textbox(for now)
thnx in advance
Prashanth
prashanth,
s/w Engineer,
Syfnosys.
|
|
|
|
|
hi all,
i need coding for following requierment
input - any date(3/04/2007)
output- start date(1/04/2007) and end date(7/04/2007)
Revathi Raj
|
|
|
|
|
What is the corelation between the input date and the output dates?
|
|
|
|
|
I think U R asking the starting and ending date of the week.
dt.AddDays(-(int)dt.DayOfWeek)
dt.AddDays(7-(int)dt.DayOfWeek)
Here dt is of type DateTime which holds the input Date.
Regards,
Arun Kumar.A
|
|
|
|
|
oh Cool guess the requirements, do you work for my company ?
g
|
|
|
|
|
i want a computer shop management project with sql sever connectivity in which we maintain all the hardware as well as other parts information.simply management program like library management and all other management projects.thank u.
|
|
|
|
|
Well congratulations. Do you mean that you want an asset inventory system? If so, you're probably going to have to end up paying for one.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete O'Hanlon wrote: Do you mean that you want an asset inventory system?
Sounds like what he's looking for. He ought to just write one himself
|
|
|
|
|
Is it URGENTZ?
Sorry but we folks here will only give away our millions lines of code that we spent months and months of blood and sweat making the suite of software that you wants (free of charge) ONLY if it is "URGENTZ".
|
|
|
|
|
Hi Friends,
How can I handle the call to specific methods based on a string value without comapring the string value using any of the control statements .
The requirement is explained as follows:
I have 3 methods here.
1. CallMethod(String s)
2. ProcessAgencyDataTable()
3. ProcessAuthorityDataTable()
Now, I should be able to call the method ProcessAgencyDataTable() when (s="Agency") for CallMethod(String s) and
ProcessAuthorityDataTable() when (s="Authority") for CallMethod(String s).
I should achieve this without using any of the control statements (like if, if-else, switch etc).
The CallMethod() should be able to call the specific method based on the value of s parameter.
Note: There will be some similarity in the Method names that will be called.
public void CallMethod(String s)<br />
{<br />
switch (s)<br />
{<br />
case "Agency":<br />
ProcessAgencyDataTable();<br />
break;<br />
case "Authority":<br />
ProcessAuthorityDataTable();<br />
break;<br />
default:<br />
break;<br />
}<br />
}<br />
<br />
private void ProcessAgencyDataTable()<br />
{<br />
}<br />
<br />
private void ProcessAuthorityDataTable()<br />
{<br />
}
Thanks for some suggestions.
Subrahmanyam K
|
|
|
|
|
You can build the method name dynamically and use Reflection to call the method.
using System.Reflection;
...
string methodName = String.Format("Process{0}DataTable", s);
Type t = this.GetType();
BindingFlags flags = BindingFlags.NonPublic | BindingFlags.InvokeMethod | BindingFlags.Instance;
t.InvokeMember(methodName, flags , null, this, null);
...
|
|
|
|
|
Hi,
Thanks a ton for your wonderful suggestion.
Regards,
Subrahmanyam K
|
|
|
|
|
This is cool i helped me too. Because i have about 10 methods to load on details on Form load
example
ReturnPersonalDetails
ReturnEducationalDetails
ReturnProfileDetails
ReturnWordDetails
Thanks again
|
|
|
|
|
I don't know what this is for, but it could be that this could be better designed - for example, having separate classes or object instances for operations on each type of table. Then you could say:
agencyDataSource.ProcessTable();
authorityDataSource.ProcessTable();
In either case, you can have a dictionary to store the methods or objects by name:
Dictionary<string, MyDataSourceObject> tableObjs = new Dictionary<string, MyDataSourceObject>();
...
tableObjs["Agency"]=agencyDataSource;
tableObjs["Authority"]=authorityDataSource;
...
tableObjs["Agency"].ProcessTable();
tableObjs["Authority"].ProcessTable();
delegate void EmptyDelegate();
Dictionary<string, EmptyDelegate> methods = new Dictionary<string, EmptyDelegate>();
...
methods["Agency"]=ProcessAgencyDataTable;
methods["Authority"]=ProcessAuthorityDataTable;
...
methods["Agency"]();
methods["Authority"]();
Or you could do it using Reflection like Brady mentioned but it's slower as far as perf.
--Justin
Microsoft MVP, C#
|
|
|
|
|
Thanks Justin,
When looking for the performance, your suggestion would serve better.
I will have to make a trade-off which way best suits for my Application.
Anyway, Thank you once again for your valuable suggestion.
Regards,
Subrahmanyam K
|
|
|
|