|
Hi
Before you can set the SomeFieldinAccount1Class property/field value you need to intialize / create the element at position 0
objTempType.P1[0] = new Account1();
|
|
|
|
|
Hello nissims,
Thanks for your reply.
i have already created the first item in P1[0](before i try setvalue thing), I just didn't want to make my post a more lengthier one, so made the code hide.
modified on Wednesday, October 7, 2009 4:23 AM
|
|
|
|
|
You can use the Array class when operating on array properties with reflection.
Using only refection, what you want to achieve is done like this:
Type objTempType = Type.GetType("C1");
object objTempObject = Activator.CreateInstance(objTempType);
PropertyInfo p1Property = objTempType.GetProperty("P1");
Array p1ArrayValue = p1Property.GetValue(objTempObject, null) as Array;
Type itemType = p1ArrayValue.GetType().GetElementType();
object itemValue = p1ArrayValue.GetValue(0);
PropertyInfo someFieldProperty = itemType.GetProperty("SomeFieldinAccount1Class");
someFieldProperty.SetValue(itemValue, SomeObjectOrValue, null);
|
|
|
|
|
Thanks Bro...
your suggestion exactly matched what i needed and was more than i expected... thanks again...
modified on Wednesday, October 7, 2009 4:23 AM
|
|
|
|
|
You welcome
|
|
|
|
|
<br />
ToolStripMenuItem firstItem = new ToolStripMenuItem("level1);<br />
for (int i = 0; i<CenterTables.Length; i++)<br />
{<br />
ToolStripMenuItem subItem = new ToolStripMenuItem(CenterTables[i]);<br />
firstItem.DropDownItems.Add(subItem);<br />
}<br />
contextMenuStrip1.Items.Add(firstItem);
in the above code centertable is a string array. I am adding the element of this array as sub menu/dropdown item for level1.
Now I need the following task:
1. No need to get the level1 selected item
2. need to handle the submenu seleted event
2. Need to get the sub menu/ dropdownitems that have been selected
How can I do that...
|
|
|
|
|
1st.:
Don't add event on top level item
2nd:
Yust add event handler for each sub menu
ToolStripMenuItem subItem = new ToolStripMenuItem(CenterTables[i]);
subItem.Click += new System.EventHandler(subItem_Click);
firstItem.DropDownItems.Add(subItem);
Also there is no Select Event, but Click.
3rd: You can get item in Event Handelr
This code is in event handler and gets ToolStripMenuItem from Object that is passet into event handler. So every SubItem with a can use same event handler and can be distinguished betwen them
ToolStripMenuItem mnu = sender as ToolStripMenuItem;
|
|
|
|
|
It's great!!!!
Thanks a lotz
|
|
|
|
|
Hi all,
I am searching the Internet for articles on how to query exchange server 2003, without any result.... Can anyone perhaps provide me with a starting point? Struggling to get out of the block
More specific ... query the appointment items on a specific mailbox
Many thanks in advance.
Kind regards,
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
modified on Wednesday, October 7, 2009 2:37 AM
|
|
|
|
|
Hi all,
Well I found an example: here[^], but I keep receiving an exception, more specifically:
On this line of code: WebDavResponse = (System.Net.HttpWebResponse)WebDavRequest.GetResponse();
Exception: WebException
Description: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
Any ideas how I can fix this?
Many thanks again.
Kind regards,
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
When requesting to https, you need to add a certificate with the request. Add that to ClientCertificates collection of request object.
To query exchange server and get all mails from inbox, you could do something like
string serverUrl = "https://yourdomain.com/exchange/userid/inbox/"
const string xml = "<?xml version='1.0'?>" +
"<g:searchrequest xmlns:g='DAV:'>" +
"<g:sql>{0}</g:sql>" +
"</g:searchrequest>";
string query = "SELECT * FROM SCOPE('SHALLOW TRAVERSAL OF \"" + serverUrl + "\"') " + "WHERE \"DAV:isfolder\" = false";
string requestString = string.Format(xml, query);
WebHeaderCollection headers = new WebHeaderCollection();
headers.Set("Pragma", "no-cache");
headers.Set("Translate", "f");
headers.Set("Depth", "0"); WebDavRequest.Method should be SEARCH . Set the WebHeaderCollection to WebDavRequest.Headers property.
I have written a useful WEBDAV wrapper for one of our application. I can share as an article later
|
|
|
|
|
Hi Navaneeth,
Thank you for the information, really appreciate it.
N a v a n e e t h wrote: Add that to ClientCertificates collection of request object.
Hmmm ... this sounds like the difficult part ...
N a v a n e e t h wrote: I have written a useful WEBDAV wrapper for one of our application. I can share as an article later
That would be awesome!!
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
Hi Navaneeth,
Now I keep receiving the following error message, could it be that the WebDav is disabled on the exchange server?
The remote server returned an error: (440) Login Timeout.
Thanks again.
Kind regards,
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
Not sure. I haven't experienced this so far. All I can suggest is to try adding more timeout value.
|
|
|
|
|
Hi,
I am facing an issue when using ErrorProvider's SetError method.
It seems the character "&" is not displayed in the error description string.
<br />
string tempStr = "Input can not contain the characters: &,^,!";<br />
this.mainErrorProvider.SetError(this.inputTxtBox, tempStr);<br />
The above code displays the tool tip consisting of the provided string but the "&" character seems to be converted to "space" character.
I am using Visual Studio 2008 with project targeted for .NET 3.0 Framework.
Any help would be appreciated.
Thanks,
sysdeamon.
|
|
|
|
|
|
Thanks, "&&&" did the trick.
sysdeamon.
|
|
|
|
|
Dear All, I have serveral pdf files, any ideas how to merge them into single file?
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
|
|
|
|
|
If you want full source, I suggest advertising on the job site, or perhaps rentacoder. Be careful, some people there take jobs, then just come here and ask us to do the work for them.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
how to post item to ebay from c#.net application.I want to list item in ebay site under particular category(for example lg camera under camera category).
|
|
|
|