|
You can use the NextMatch member of the Match class.
Regex re = new Regex();
Match m = re.Match();
while (m.Success())
{
m = m.NextMatch();
}
|
|
|
|
|
Thanks mate And Merry Christmas!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Ho ho ho fellow coders....
is there a way to convert the following recursion code to read this string value??
String Value = "Section1:Section2\\Section3\\Section4\\Section5\\Section6\\Section7\\Section8\\Section9\\etc";
Sample recursion code =
private void btnFillTree_Click(object sender, EventArgs e)
{
directoryTreeView.Nodes.Clear();
String path = "c:\\Temp";
directoryTreeView.Nodes.Add( path );
PopulateTreeView(path, directoryTreeView.Nodes[ 0 ] );
}
public void PopulateTreeView(string directoryValue, TreeNode parentNode )
{
string[] directoryArray =
Directory.GetDirectories( directoryValue );
try
{
if ( directoryArray.Length != 0 )
{
foreach ( string directory in directoryArray )
{
substringDirectory = directory.Substring(
directory.LastIndexOf( '\\' ) + 1,
directory.Length - directory.LastIndexOf( '\\' ) - 1 );
TreeNode myNode = new TreeNode( substringDirectory );
parentNode.Nodes.Add( myNode );
PopulateTreeView( directory, myNode );
}
}
} catch ( UnauthorizedAccessException ) {
parentNode.Nodes.Add( "Access denied" );
} // end catch
}
thanks in advance for any information
rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
What do you want to do? Do you want to fill your tree view with node parsed from the string?
I'd use a regex for this task and loop over the matches.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Yes I want to fill the tree with the nodes passed from the string.
The string is in the same format as a directory string but I dont know of a way to perform the task that
string[] directoryArray =
Directory.GetDirectories( directoryValue );
is doing?
any thoughts or an example of what you stated?
rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
I'd need a better example string, so I can write a proper regex for it.
Do you have one available?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
String Value = "Section1:Section2\\Section3\\Section4\\Section5\\Section6\\Section7\\Section8\\Section9\\etc";
This is a typical example.
the only thing that is constant is Section 1 and Section 2, the rest of the sections vary as far a node levels beneath them etc.
thx again for taking the time to look at this!!
rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
I don't see any recursion in the string, but you may try this pattern:
[^\\]*
To loop over the results please take a look at the topic above yours
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
This is a cool trick...not sure how it helps me for this but I got it working this way
String strValue = "Section1\\Section2\\Section3\\Section4\\Section5\\Section6\\Section7\\Section8\\Section9";
// [^\\]*
string str = strValue;
string pattern = @"[^\\]*";
foreach (Match m in Regex.Matches(str, pattern))
{
Console.WriteLine(m.Value);
}
much more elegent way of breaking up the string into its pieces.
As far as the recursion is concerned the section values in the above string were just an example.
How would you populate the treeview with this??
tia
rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
<div class="ForumMod">modified on Wednesday, December 24, 2008 1:01 PM</div>
|
|
|
|
|
Rafone wrote:
How would you populate the treeview with this??
Instead of doing a Console.WriteLine you could add the nodes to the treeview inside the loop, for example.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
i am developing an application for my office and i want to see others desktops and what are they doing and also sometimes take control over their mouse and of course key boards, i have searched the web alot and just find some vnc or RDP solutions but i am still need help how to do that
(i am coding c# )
|
|
|
|
|
RealVNC AFAIK is free and will do the job, this is a pretty big project to start from scratch.
|
|
|
|
|
thanks and where i can find it? never mind i will digg the web again
|
|
|
|
|
|
When I run the following code on Vista, it updates the label1.Text on the form with each value in textBox1.Text on every "while" loop. This is how I want it to work.
However, when I run the same code on XP, it waits until the "while" loop is complete then only updates label1.Text with the last value in textBox1.Text. Until then, it stays blank.
Is there a way to make it work on XP the same way it works on Vista?
Thanks!
StringReader text = new StringReader(textBox1.Text);
string line;
while ((line = text.ReadLine()) != null)
{
string cmdline = "c:\\windows\\*.* /y /c /i c:\\temp\\windows_backup";
ProcessStartInfo psi = new ProcessStartInfo(@"xcopy.exe", cmdline);
psi.WindowStyle = ProcessWindowStyle.Hidden;
Process p = Process.Start(psi);
p.WaitForExit();
label1.Text = line;
}
}
|
|
|
|
|
Well, your code appears to wait for the process to exit before updating the textbox. Try moving that line label1.Text = line; to the top of the loop. (I'm surprised it works in Vista as it is right now.)
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Thanks John. I want the update to happen only after the process exits, so that's fine. The process does indeed exit so I'm not sure why you think it wouldn't work.
|
|
|
|
|
You could call Application.DoEvents() after setting the new text to force an update of the textbox. While I don't like this solution it should still work.
Like John, I'm a bit surprised that it updates on Vista after all with this code.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thanks Greeg, I'll give that a shot and let you know if it works.
|
|
|
|
|
Hey Greeeg, Application.DoEvents() worked!!!
You're great.
And, thanks John for responding so quickly. I did try your suggestion prior to my post and it didn't make a difference.
Thanks again guys!
--Clark
|
|
|
|
|
Well... i not find any infos about how to make a GET request using a http proxy (using sockets and not the .net library).
I go to repeat USING SOCKETs and NOT the HttpWebRequest...
Thanks in advance.
|
|
|
|
|
Hello Sir,
Please help me ?
I am createing a custom combo box control in c#.net 3.0 by inherit combo box. in this control i am using OnPaint and OnPaintBackground to paint combo button .
The problem came when paint event fire's, it Black the inner combo box color(is this is nonclient area?).and not show back color in combo's inner area.
and here dropdownstyle=dropdown.
But when i set dropdownstyle=dropdownlist then it will fine. now the problem with this is it will not show the text in combox after drop down list is closed.
Now couldn't find the way how proceds further.
Thanks.
|
|
|
|
|
Hi,
I've worked on OLE DB templates like DEFINE_COMMAND_EX, BEGIN_PARAM_MAP etc. in VC++. Now I need to convert that functionality into C#. I'm new to C#. So please tell me whether C# is having the similar sort of templates.
Following is an example in VC++ using OLE DB templates
class CGetDetails
{
public:
LONG m_CompanyId;
BEGIN_COLUMN_MAP(CGetDetails)
COLUMN_ENTRY(1, m_CompanyId)
COLUMN_ENTRY(2, m_CompanyName)
END_COLUMN_MAP()
DEFINE_COMMAND_EX(CGetDetails, _T(" SELECT * from companylist"))
BEGIN_PARAM_MAP(CGetDetails)
END_PARAM_MAP()
void ClearRecord()
{
memset(this, 0, sizeof(*this));
}
};
Now I need similar sort of class in C#. Could you please tell me the related possibilities?
Thanks in advance,
Malleswari.
|
|
|
|
|
Try here[^]
only two letters away from being an asset
|
|
|
|
|
hi , i would like to get the drivers of hard disk
but i dont know how can i achive this
thanks for help
MD_NADA
|
|
|
|