|
Hi there.
How can we collapse a node in treeView (WinForm) ?
Thank you.
|
|
|
|
|
Hi,
Please try this code snippet:
void CollapseTree(TreeNode ParentNode)
{
if(ParentNode.IsExpanded)
ParentNode.Toggle();
for(int i=ParentNode.Nodes.Count-1;i>=0;i--)
{
if(ParentNode.Nodes[i].Nodes.Count>0)
{
if(ParentNode.Nodes[i].IsExpanded)
ParentNode.Nodes[i].Toggle();
CollapseTree(ParentNode.Nodes[i])
}
}
}
For more details please visit the following link:
Article1[^]
Hope this helps .
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
So you used Toggle() method.
Thank you
|
|
|
|
|
Hello
1-i have a method of weather web service, but i do not know how using it in my client windows form.
URL:http://www.deeptraining.com/webservices/weather.asmx
2-I have a C# code about weather web service,but i do not know how using it in my server for making web service.
URL:http://barnamenevis.org/forum/showthread.php?t=47550&highlight=%D9%87%D9%88%D8%A7
thanks
|
|
|
|
|
Hello.
Well,here[^] there are many useful posts.
Why don't you use them ?
|
|
|
|
|
hello
I know them,but i do not know how using them.
I want help about them.
thank you
|
|
|
|
|
Hi there.
I have a code like this :
Regex.IsMatch("sth", textBoxSearchTxt.Text.Trim(), RegexOptions.IgnoreCase)
Thus I must extrude ESCAPE CHARACTERS from textBoxSearchTxt.Text
How can I do this by C#
As always thanks in advance.
modified on Monday, August 11, 2008 8:28 PM
|
|
|
|
|
Mohammad Dayyan wrote: Thus I must extrude ESCAPE CHARACTERS from textBoxSearchTxt.Text ( Like + * ( ) ... )
I am confused, + * ()... are not escape chars? what are you trying to exclude none alpha chars?
this RegEx will remove all except alpha-numeric.
string newString = Regex.Replace(oldString, "[^A-Za-z0-9]", "");
Yusuf
|
|
|
|
|
Oh, I'm sorry.
I mistook.
Yusuf wrote: string newString = Regex.Replace(oldString, "[^A-Za-z0-9]", "");
Thank you.
|
|
|
|
|
How do I get the current Date and Time in .NET fw.
Please let me know.
Thanks,
Happy Programming!
Regards,
ctrlnick !
|
|
|
|
|
Is this your purpose?
DateTime time = DateTime.Now;
Console.WriteLine(time);
Console.ReadKey();
|
|
|
|
|
You use DateTime.Now to get the current date and time on the local machine.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
use the above code and add a timer object so that you can refresh your clock ok? choose timer tick event and add the code to it.
nelsonpaixao@yahoo.com.br
|
|
|
|
|
Hello,
I was trying to load data from xml files to SQL Server tables.
I am using XMLTextReader to read from the files. my code's working and loading information to two tables. Except, few fields.
They show no values when read - even though the file contains values for them.
I notice all of them are either unsignedByte or unsignedInt type in the xml schema.
I changed them to strings just to test, but it's doing the same.
I think the datatype is not making any difference, but these elements don't have any attributes and the values are directly in the tags.
So, could be I'm missing something. Here's part of my code:
while (reader.Read())
{ switch (reader.NodeType)
{ case XmlNodeType.Element:
if (reader.Name.ToLower().Equals("decimals"))
{ dec = reader.Value; }
..... break;
case XmlNodeType.Text:
...nothing break;
case XmlNodeType.EndElement:
break;
}
}
Any idea, what's wrong?
Thanks.
|
|
|
|
|
Did you step through your code to see what's happening ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Yes i did. I even used the reader.HasValue property and it's coming up with false.
For some reason, it's not recognizing there's any value - when I do have values.
|
|
|
|
|
I think I found the reason.
For elements that hava values directly in it, no attributes - the control goes to XmlNodeType.Text. So, I need to write my code under this case =>
Case XmlNodeType.Text:
.....
.....
But here, how do I refer to the name of the element? the reader.Name property doesn't work here.
Thanks.
|
|
|
|
|
<b>Hello fellow coders,
Anyone know how to implement a C# script into a html href tag so when someone clicks the link, the script executes?
I've done it with javascript, but I cant get it to work under C#. I'm using asp .net IIs and all the things I need.</b>
<pre> string path = "C:\\Program Files\\Common Files\\Microsoft Shared\\Help 9\\dexplore.exe";
string keyword = "default";///get the keyword from the code somehow...this is just an example
string argumentos = "/helpcol ms-help://ms.vscc.v90 /LaunchFKeywordTopic " + keyword;
/// "/usehelpsettings VisualStudio.9.0";
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(path, argumentos);
System.Diagnostics.Process.Start(startInfo);</pre>
<b>I need that piece of code to be executed when I click a html link, that btw is created dinamically by code.
...
The page source code is this:</b>
<pre>
<![CDATA[<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>]]>
<script runat="server">
public void opendexplore(){
string path = "C:\\Program Files\\Common Files\\Microsoft Shared\\Help 9\\dexplore.exe";
string keyword1 = "String"; ///"default";get the keyword from the code somehow...this is just an example
string argumentos = "/helpcol ms-help://ms.vscc.v90 /LaunchFKeywordTopic " + keyword1;
/// "/usehelpsettings VisualStudio.9.0";
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(path, argumentos);
System.Diagnostics.Process.Start(startInfo);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<a href="Default.aspx" onclick="opendexplore()">CLICK</a>
</div>
</form>
</body>
</html>
</pre>
<b>Thanks you for your help</b><pre></pre>
|
|
|
|
|
charlieyv wrote: Anyone know how to implement a C# script into a html href tag so when someone clicks the link, the script executes?
Somebody kill me.
My friend, nothing personal. But please atleast read and do a bit of research before starting to prgram something.
|
|
|
|
|
|
I need some help deciding how to store my data. Basically I don't want to have a complicated database because in the end it will be a software on someone else's pc and I don't want them to have to install database services and such, and I don't want to host the database myself. However I could just use an access database right??? Now I could build business objects and serialize them to an xml file, but it's a lot of work building the objects. However xml files are automatically supported and my program can even create one if one is not existent. These are some of the things that are running through my head. I would like some advice on what other factors or which of these factors seem really important to you an why. One factor that I believe is that I have already started building objects but that I am recognizing the time consumption. I have written some 2000 lines of code of business objects but I estimate that it will be 5 times that in the end if I continue down the road I am on. It might not be too late to build a database to do all that these objects do.
|
|
|
|
|
bfis108137 wrote: I don't want them to have to install database services and such
Why not? You can easily use something like SQL Server Compact Edition which the user doesn't have to configure at all.
|
|
|
|
|
I am not familiar with it. Do I do all the configuring in my program and then it is just a file for access by the program like access or does SQL Server Compact need to be installed on the pc as well?
|
|
|
|
|
Sql Server CE runs as a DLL in your application. This[^] article will help.
|
|
|
|
|
Hi,
First of all let me say that this is not an answer but just a bunch of additional questions. When reading your post I was wondering questions like:
- do you need concurrency control? This seems like single user application if your data is located on client, but do you have simultaneous threads accessing the same data.
- how much data do you plan to store. If there's going to be "lots" of it, you may end up with performance issues without a good data store
- how about state handling and transactions. Are they needed
- is referential integrity or key handling needed between serialized data
- is there a reason why you don't want to use datasets for storing data (if theres only a small amount of data)
- security issues of any kind, access rights etc
- backups needed at any time and how they are handled and so on...
Including a database (of some kind) into your project is going to cause some "extra work" for you but it also takes away much coding when it comes to the issues mentioned above. Usually the savings is greater. This approach also adds scalability to your project if needed.
Database can be installed with a very small footprint and the installation usually can be completely added to your deployment mechanism. Some of those databases are (just my preferences) Oracle XE, SQL Server Express Edition and DB2 Express-C. But still, not saying that is the optimal approach to you.
Mika
|
|
|
|