|
I'm not sure what problem you are having - there is no copying going on, so what make you think you are dealing with a copy?
I would also be tempted to use the Tag field of the checklist to refer directly to the ToolStripMenuItem it enables / disables rather than loop round each time I want to enable / disable it via the text string.
All those who believe in psycho kinesis, raise my hand.
My 's gonna unleash hell on your ass. tastic!
|
|
|
|
|
Hey Griff,
Thank you for your time.. and please, tell me about this "Tag" thing.
|
|
|
|
|
My apologies! CheckedListBoxItem uses strings rather than an object derived from ListViewItem (unusually), and so there is no Tag to use.
So, why do you think it is a copy?
All those who believe in psycho kinesis, raise my hand.
My 's gonna unleash hell on your ass. tastic!
|
|
|
|
|
OriginalGriff wrote: CheckedListBoxItem uses strings rather than an object derived from ListViewItem
That's where I thought I was missing something but it's okay.
OriginalGriff wrote: So, why do you think it is a copy?
Simply because nothing happens when I set their Enable property to true
|
|
|
|
|
Wait, it works like a charm when calling it from the very same form but I'm trying to access it through an object from the class and these controls are not static
Forget about it, I'm calling it from the same form now and that's what I was going to do eventually
|
|
|
|
|
how to set crystal report textobject value in runtime??
|
|
|
|
|
hello every body
i want to get the file list one by one in a lable giving path of the folder of the file using this code but it does not work
for (int i = 0; i < Directory.GetFiles(textBox1.Text).Length - 1; i++)
{
object[] file=Directory.GetFiles(textBox1.Text+@"\");
label2.Text = file[i].ToString();
}
can any body
explain me
|
|
|
|
|
as i understand
you want to write all dir. in label, try this:
for (int i = 0; i < Directory.GetFiles(textBox1.Text).Length - 1; i++)
{
object[] file=Directory.GetFiles(textBox1.Text+@"\");
label2.Text += file[i].ToString()+"\n";
}
or
arraylist a=new arraylist();
for (int i = 0; i < Directory.GetFiles(textBox1.Text).Length - 1; i++)
{
object[] file=Directory.GetFiles(textBox1.Text+@"\");
//label2.Text += file[i].ToString()+"\n";
a.add(file[i].ToString());
}
|
|
|
|
|
thanks sir
but exactly what i need is
the files name
of the dir. is just kike the anti virus file scane
looks
that is file name
and the path is showing in the lable might be using timerin it
private void button1_Click(object sender, EventArgs e)
{
timer1.Start();
timer1.Interval = 2000;
}
private void timer1_Tick(object sender, EventArgs e)
{
for (int i = 0; i < Directory.GetFiles(textBox1.Text).Length - 1; i++)
{
object[] file=Directory.GetFiles(textBox1.Text+@"\");
label2.Text = file[i].ToString();
}
timer1.Stop();
}
whatis the problem in it
this shows only the last file of the dir.
|
|
|
|
|
sorry are you trying to make anti virus program
|
|
|
|
|
No
sir
i just try
to make
a file counter in my program
that it------------->>>>>>>>>>>>>>>
can u hepl me..........>>>>>>>>>>>>>>>
|
|
|
|
|
for (int i = 0; i < Directory.GetFiles(textBox1.Text).Length - 1; i++)
{
object[] file=Directory.GetFiles(textBox1.Text+@"\");
for(int x=0;x
|
|
|
|
|
tanweer akhtar wrote: for (int i = 0; i < Directory.GetFiles(textBox1.Text).Length - 1; i++)
{
object[] file=Directory.GetFiles(textBox1.Text+@"\");
label2.Text = file[i].ToString();
}
timer1.Stop();
}
Yes, it will show only the last file in the list. Try replacing:
label2.Text = file[i].ToString(); with
label2.Text += file[i].ToString(); as this means the new name will be appended to the existing text, rather than replacing it.
You will also want to clear the label2.Text before entering the for loop, and add a newline to the end of the name (or they will all run together in one big line).
Other improvements you may want to do:
1) Change the label for a ListBox - it is better designed for showing lists than a label.
2) Consider using foreach rather than your existing for loop:
DirectoryInfo dir = new DirectoryInfo(dirname);
foreach (FileInfo fi in dir.GetFiles())
{
string filename = fi.FullName;
...
}
All those who believe in psycho kinesis, raise my hand.
My 's gonna unleash hell on your ass. tastic!
|
|
|
|
|
Hello,
I have a datagridview with a horizontal scrollbar. How do I track the scrolled event?
Pritha
|
|
|
|
|
Hi,
Im using C#,WPF in VC++.
For buttons in C# ,i created Delegates and events and i use that in VC++.
But i cannot use Textbox form C# in vc++.I cannot enter any value in that textbox.
Just my assumption is whether i have to use any eventhandler for this. if any means pls provide.
I want to use textbox compulsory.So im struglling in this issue.Pls help.
Anu
|
|
|
|
|
I realise that I could wade through SBs threading 1-5 but I'm as lazy as the next person.
If I fire of a long running thread from the winform, that calls multiple methods in the business object layer which call stored procs and the user closes the form before the thread has completed, what happens to the thread.
I assume it completes the current stored proc and then terminates.
I use the following to call start the thread
var t = new Thread(() => DoTB(iPeriodID));
t.Start();
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Well, if by closing the form you mean closing your application, it depends whether the new thread is marked as background or not. If its a background thread, the process ends immediately, if not, the process will live as long as the thread(s) take to execute.
http://msdn.microsoft.com/en-us/library/h339syd0.aspx[^]
As far as the stored proc bit goes, that's in a seperate process so I'd expect it to run to completion once started.
Regards,
Rob Philpott.
|
|
|
|
|
Said threads will now be marked with background - thank you
I'm not worried about the stored procs, I'll just let them run.
Would it be reasonable to put the started thread into a local property and check whether it is alive in the form closing event, then call thread abort if it is still running.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: Would it be reasonable to put the started thread into a local property and check whether it is alive in the form closing event, then call thread abort if it is still running.
If you are going to do this, you might want to consider using a BackgroundWorker. That wraps up an asynchronous thread into a convenient class that you can monitor for progress, get callbacks when it completes (including a notification if it ends abnormally with an error) and cancel it in a controlled manner if you want to end it early. There doesn't seem much point in writing your own code to do all that when .NET gives it to you anyway.
|
|
|
|
|
I will need to do some user interface development in the MS environment and although I am an experienced c/c++ developer, I would like to explore the pros and cons of these 2 languages. What are the pros and cons and any suggestions would be appreciated. I hear resharper is a good product to use with c#. Any thoughts on this?
Thanks in advance for any suggestions.
|
|
|
|
|
This will not be a complete list, but rather a simple observation:
If you are doing UI than I think that the developement speed and ease should be enough to convince you to use C#. Don't get me wrong - I have spent my entire life coding C++ (still am), but whenever I need anything with a standard windows UI - then C# is my first choice.
The drawback in some cases is the need to have .NET installed, but today most systems have it anyway
|
|
|
|
|
What do you know about the resharper?
|
|
|
|
|
As I mentioned I mostly do C++, so I have only tried the trial version of resharper. I did like it, and to tell you the truth, everyone I know likes it But you really should give it a go yourself - the trial gives you 10 days to make up your mind.
|
|
|
|
|
Hi, I need to strip out text from a big file and my condition is:
I need to strip out text from below
<div class="a">apple</div>
<p> </p>
<p>red delicious</p>
<div class="b">banana</div>
<p> </p>
<p>riped banana</p>
<div class="c">chives</div>
<p> </p>
<p>fresh green chives</p>
to below
'apple', 'red delicious'
'banana', 'riped banana'
'chives', 'fresh green chives'
so that i can enter each of them to database. I would really appreciate if you could please provide me a regex that could do this. thanks for your help!!!
please note the content of the text is a concatination of multiple html pages.
|
|
|
|
|
repost[^], and no PRE tags once again ==> no help
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|