|
Thanks for that, but it gave me out of index error, but i just twisted your code somewhat and this is what i did and got the folder details i need.
Outlook.Application OApp = new Outlook.ApplicationClass();
Outlook.NameSpace ns = OApp.GetNamespace("MAPI");
Outlook.MAPIFolder inbxfld = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
Outlook.MAPIFolder prsnlfldr = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
Outlook.Folders pfldr = ns.Folders;
Console.WriteLine(pfldr.Count);
foreach(Outlook.MAPIFolder fld in pfldr)
{
Console.WriteLine(fld.Name);
}
Thanks a million for your help and getting me out of this
Now I am going a step further!
Btw, liked your line "Just because we can; does not mean we should."
|
|
|
|
|
I am trying to create a method where if a user clicks on the checkbox of a treeview node it deletes it only if it is a childnode but does not delete it if it is a rootfolder. This is how I started. If anybody can give me a clue and show me how to make it work? Thanks.
private bool CheckBox(TreeNode tn)
{
if (tvFavorites.SelectedNode.Checked == true)
{
//tn.Nodes.Remove();
tvFavorites.SelectedNode.Remove();
}
else
{
return CheckBox(false); and here I get an error that "Best overloaded method: invalid argument.
}
}
modified on Friday, December 28, 2007 2:36:51 PM
|
|
|
|
|
A) To solve your problem, check to see if the selected node is a child node and perform your actions accordingly.
B) Your error; You are calling the function CheckBox passing the variable of type bool when its expecting type TreeNode. To solve, simple replace that line with "return false;"
Just because we can; does not mean we should.
|
|
|
|
|
private bool CheckBox(TreeNode tn) //but then I got an error here which says "not all paths return a value". So, what should I do now??
{
//if (tn.Checked == true)
if (tvFavorites.SelectedNode.Checked == false) //
{
//tn.Nodes.Remove(true);
tvFavorites.SelectedNode.Remove(); //
}
else
{
return false; // I modified my code here as per your suggestion
}
}
|
|
|
|
|
I'd recommend reading up on returning values from a function, google can help you there.
<br />
private bool CheckBox(TreeNode tn)
{<br />
if (tvFavorites.SelectedNode.Checked == false)
{<br />
tvFavorites.SelectedNode.Remove();
<br />
return true;
}<br />
else<br />
{<br />
return false;
}<br />
<br />
}
Just because we can; does not mean we should.
|
|
|
|
|
Thank You for the return true; statement. Atleast I dont get that error now. But I am trying to find out how to make the checkbox delete the childnode and not the root node.
That private bool CheckBox(TreeNode tn) does not get executed
|
|
|
|
|
Your function CheckBox(TreeNode tn) returns a type of boolean.
Are you doing anything with that return value?
In your checkbox checked event are you telling it to run CheckBox?
Is this the path your code is taking?
user clicks check box
->checkbox event triggers
-->checks to see if its a child node; if so
-->CheckBox code is run (removing the treenode) return true if successful, else false
Hope this helps you get back on track.
Edited to add:
To check if a treenode is the root node, check the Level property.
if(TreeViewNode.Level == 0)<br />
{<br />
....<br />
}<br />
else<br />
{...}
Just because we can; does not mean we should.
|
|
|
|
|
if(TreeViewNode.Level == 0)
{
tn.Nodes == true; //here i want to enter a code which will tell me that it is a root node. How should I put that code here it gives me an error "Operator == cannot be applied to bool"
}
else
{
tn.Nodes.Remove(false); //"here it gives me an error "Best overloaded method:has some invalid arguments"
}
|
|
|
|
|
Ok lets see here.
if(TreeViewNode.Level == 0)
{
//you know this is a root node(because the level is equal to zero, the first level of nodes!) so do not do anything!
}
else
{
//this is a child node so lets remove it.
}
<br />
private bool CheckBox(TreeNode tn)<br />
{<br />
if (tn.Checked == false)<br />
{<br />
if(tn.Level != 0)<br />
{<br />
tn.Remove();<br />
<br />
return true;<br />
}<br />
else<br />
{<br />
return false;<br />
}<br />
}<br />
else<br />
{<br />
return false;<br />
}<br />
}<br />
use this function like this
<br />
if(CheckBox(tvFavorites.SelectedNode) == true)<br />
MessageBox.Show("It was removed.");<br />
else<br />
MessageBox.Show("Its still there.");<br />
Good Luck.
Just because we can; does not mean we should.
|
|
|
|
|
Hi all,
I posted this on the .NET Framework board about a week ago and got no response, so I thought I'd try here.
I'm developing an application in which I bind to XmlDataProvider.Source property. If the xml file I'm binding to has an extension of .xml everything is fine. If it has some other extension the binding fails.
I posted on forums.microsoft.com and was given instruction to go to the Connect website and log this as a bug. Maybe I'm stupid, but I cannot figure out how to do that.
I'm posting the link to my post on the forums. I hope that doesn't violate any forum posting "codes of conduct".
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2538606&SiteID=1&mode=1[^]
If anyone has any advice, suggestion, or knowledge about this problem I would love to hear it.
Thanks.
Lily Bristol
|
|
|
|
|
You can embed inline XML, Use a Uri or an XmlDocument
Which one are you using?
You could do the following, but I'm sure there is a better way.
<br />
WebClient wc = new WebClient();<br />
byte[] data = wc.DownloadData("http://.......");<br />
wc.Dispose();<br />
string source = System.Text.ASCIIEncoding.ASCII.GetString(data);<br />
<br />
XmlDataProvider.Source = source;
<br />
Just because we can; does not mean we should.
|
|
|
|
|
Hi,
Thanks for the response. Just getting back to work after Holiday break.
If you follow the link found in my original message (for some reason it is not clickable, but if you cut-and-paste into a browser it should work) it shows the code I'm using. In a nutshell, I'm trying to assign a new URI to an XML file. If the file (specialXmlFile in my example) has a .xml extenstion all is well. If it doesn't the binding does not take.
Lily Bristol
|
|
|
|
|
Hello
I have create a form (assume form1)this form has a name and password fields , I have another form (assume form2) it`s have a password changer
like
password :
confirm a new password :
by those fields I must change the password field in form1
please can anyone help me
<<<<<<<<<<<<<<<<<<<<<<<<<<<Best wishes>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
|
|
|
You'll need to store a "reference" to both forms somewhere so you can access both of them. Or alternatively store the password in a commmon location.
Here's a simple example (don't follow it for security reasons):
public class DataStore
{
public static string Password { get; set; }
}
public class Form1 : Form
{
private void txtPassword_TextChanged(object sender, EventArgs e)
{
DataStore.Password = this.txtPassword.Text;
}
}
public class Form2 : Form
{
private void ChangePassword(string newPassword)
{
DataStore.Password = newPassword;
}
}
|
|
|
|
|
Hello
Thanks for your answer but what can I write in class datastore (exactly in get & set)
<<<<<<THANKS A LOT>>>>>>
|
|
|
|
|
johnIT86 wrote: (exactly in get & set)
Those are automatic properties which require C# 3.0. You could write them as such:
public class DataStore
{
private static string m_Password;
public static string Password
{
get { return DataStore.m_Password; }
set { DataStore.m_Password = value; }
}
}
|
|
|
|
|
Not the best architecture seen so far.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Why do you need to change the password in form1? You should not be displaying passwords, only asking the user to input. Change the password in form2, then go back to form1 as normal.
only two letters away from being an asset
|
|
|
|
|
Can anyone recommend a component, close or open-source (no GPL please), that has a decent editor to be embedded into an app?
Cheers
modified on Friday, December 28, 2007 3:33:32 PM
|
|
|
|
|
Actipro seems to be the defactor syntax editor for .NET applications. Syncfusion also have one I think.
There is also a free one that was initially by Compona but is now called Fireball or something else, there's an article on it here.
There's also ICSharpCode.TextEditor (from SharpDevelop)
If you don't want fully managed libraries there was also a managed wrapper around Scintilla that's gone through several incarnations, I don't know what the status of that one is anymore.
|
|
|
|
|
Many thanks Ed, hope there is more to check out.
From what I see Scintilla was a nice shot but remains to be well-supported etc. The managed wrapper I searched for got me to CodePlex (scintillanet) for people interested.
The one done here is on sourceforge but I think it lacks features or under-developed as of late.
So giving up on those two I checked out the Actipro vs Syncfusion and the latter seems to be cheaper and more heavy on ad machinery. But I appreciate the hint Actipro is the standard out there.
Are there any others?
Was just looking at VSX (and VS2008 route, sure it would give a huge feature set and virtually for free) but it is slightly an overkill as I just wanted Intellisense/code-completion and initially C# support (perhaps move on to other languages later). I guess it tells a lot where MS is going with dev tools and perhaps even XNA. Also that kind of VS 'hanging' complexity is bound to bring many bugs out in VS2008 SDK (and likely never to be available in Express editions) although I see it is available as open source to certain customers.
SharpDevelop was always an option although I am not really sure about their licencing (recently changed to LGPL?).
|
|
|
|
|
SharpDevelop is LGPL since 2005 (http://laputa.sharpdevelop.net/SharpDevelop2LicenseChangedToLGPL.aspx[^]).
The text editor alone doesn't have C# code-completion, but you can use implement code-completion if you combine it with other SharpDevelop LGPL libraries. There is an example standalone C# editor with code completion in the SharpDevelop source code download.
|
|
|
|
|
I would highly recommend Actipro's editor. If you are only looking for C# intellisense, then their control has it "built-in" with the .Net language add-on. So you could get up an running very quickly.
Initially, (with version 3.x and earlier) they only provided the ability to show intellisense (e.g. it didn't do it for you). I think Synfusion still works this way.
They also have the best support I've ever run into.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Cheers for your input guys, they all look great for a start. Although I can see myself looking deeper at both of them later (requiring Intellisense and good editing experience as a starting point is just a side-effect), I'd like to initially just get it over with and move on to the problem domain.
Thanks again..
(hope I don't see myself ending up looking along the lines of real-latent emergence of VBA SDK ,ie.once it became obsolete, equivalent in .NET Once you start with features and accepting requests for change, it becomes an unstoppable process)
|
|
|
|
|
I've experienced coding against a trial of Actipro's and also an old version of Syncfusions and my preference would be Actipro if I had a project that could justify the cost.
Don't know about VSX at all.
I recently had a look at SharpDevelop's latest release and the whole thing seemed much easier to use than I remember although there is very little documentation for it so if you're stuck you have to ask on the forums or look at the source code. Actipro will have the benefit of many more examples, every example for #Develop points you to the #Develop code and this is just too big and abstract for many things.
|
|
|
|