|
Please verify that u didn't set the text property of your control at design time.
this appears to be a problem to me as u set the text property at design time and then again adding the same string in constructor
|
|
|
|
|
I'am not setting text property, and also this control has not Text property.
Nouman, the problem is caused by designer, in form.designer unit, when i drop the control it generates the same initiliazition as my control constructor, i know i can delete these lines from form.designer but is not the solution because i use my control in a lot of forms and i should delete these lines every time i use this control (is not logic). I am sure there is way to avoid it.
|
|
|
|
|
Try using the DesignMode or Site property to only adding the sample item when it is _not_ in design mode.
|
|
|
|
|
?thanks darkelv, but it not runs, why?
Because designer still writing
this.newListBox1.Name = "newListBox1";
in form.designer and in execution the control creates the first item due control constructor and the same item again due designer initialization, but thanks for the idea
|
|
|
|
|
Hi All,
Dears
I need method to know Odd and Even number.
from: 0 1 2 3 4 5 6 7 8 9
Thank you in Advance
(Riaz)
|
|
|
|
|
Hi!
Just use the modulo operator % .
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Divide your number with 2 using % operator and if your answer is not zeor than the number is odd else it is even
|
|
|
|
|
|
Hi i want to develop a profiling tool. I just need to add TRACE to a .net assembly's(exe or dll) all methods before its execution.
is it possible to modify the assembly by inserting code for trace?
My small attempt...
|
|
|
|
|
Is there a way to print word docs (without a preview) using word automation?
John
|
|
|
|
|
Hello,all:
I am using ArcEngine(a software managing spatial data) to upload data(shapefile etc.) to database.Because the process of uploading data is time-consuming,when I click the ProgressBar window or minimize the parent window and then maximize the parent window,the parent window and the ProgressBar window is white using single thread.
So,I use multithread to work out this prolem,and it does.But,the speed of uploading data to database slows down greatly . The work uploading data is no more than 10 minutes in single thread,but 40 minutes in multithread!!
Who can help me?I appreciate your help!
private delegate bool UpdateHandle(int nValue,string text);
private UpdateHandle myUpdate = null;
myProcessBar is a Window has two controls,a ProgressBar named Bar and a Label named LabelInfo.It has a public method
BeeUpdate(int value, string text)
public bool BeeUpdate(int value, string text)
{
LabelInfo.Text = text;
LabelInfo.Refresh();
if (value > 0)
{
if (Bar.Value + value < Bar.Maximum)
{
Bar.Value += value;
Bar.Refresh();
return true;
}
else
{
Bar.Value = Bar.Maximum;
Bar.Refresh();
this.Close();
return false;
}
}
return false;
}
the delegate entry point:
private void ShowProcessBar()
{
myProcessBar = new ProgressBee("Uploading", 100 * ClassCount);
myUpdate = new UpdateHandle(myProcessBar.BeeUpdate);
myProcessBar.ShowDialog();
myProcessBar = null;
}
the method called by MainWindow
public bool CopyTo(parm1, parm2,Form caller)
{
MethodInvoker mi = new MethodInvoker(ShowProcessBar);
mi.BeginInvoke(null, null);
caller.BeginInvoke(mi);
Thread.Sleep(2000);
Thread copyProcess = new Thread(delegate()
{
for (int i = 0; i < FeatureClassCount; i++)
{
Thread.Sleep(30);
if (condition)
{
}
else
{
}
caller.Invoke(this.myUpdate, new object[] { 100, "……" });
}
});
copyProcess.Priority = ThreadPriority.AboveNormal;
copyProcess.Start();
return true;
}
|
|
|
|
|
Threads don't speed things up. They slow them down, by causing your UI thread to also take process time. Having said that, what is your UI doing to use up that much time ?
Nothend wrote: Thread.Sleep(30);
Why force a sleep in a process that is already slow ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I'm Trying to Build a Project Manager Form within an MDI application that I've already made. I have the Form Set up, but I'm having problems making it work. What I want to do is Make it so that the user click on a button in the main form and it adds a Task to either a list view or a grid view in the Project Form. Then I want the project form to take the task data and put it into the chart that i have. Each task will show up as an independent series and the start date will mark the start point, the finish date will mark the end point of the series on the char.
As of right now, I don't care for making the Chart work (that will come later). What I want to know is how to make a Grid View or List View control work to display the Project Management Data and how to save that data in a file to be loaded up again.
|
|
|
|
|
I am writing my first Windows programs. I have a welcome form which invokes another form which invokes another form etc.
I want to read data from a data file, store it into a list, and have the contents of the list available to all other forms (code).
If this was one file C++ program , I could choose to declare the list globally (at the top of the file) or to pass the list as parameter to the other functions. However, with all these generated form files, i am a bit confused as how to accomplish the same effect in c#.
Could someone point me in the right direction
|
|
|
|
|
Well, you could make the list static and public in one of the classes, and then get it by using className.myList but er, that wouldn't be very good really.
Or, you could pass the list to each form via its constructor (so when you create the form you'd go myForm = new Form(myList); ) and so each form would have access to the list.
Another route might be to create a singleton class and put the list in that. Then whenever you need to access it, you can just get the instance of the class and get to the list from there.
And a link on singleton classes if you have not encountered them before: clicky[^]
There's probably another way, but i grow weary of typing, and must sleep
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
One technique would be for the subforms to accept the list as a parameter to their constructors, then the calling form would pass the list when it constructs the subforms.
Another would be for the subforms to have a Property to accept the list, and the calling form could instantiate the subform, set the Property, then show the form.
There is no reason why any two cats should be skinned the same way.
|
|
|
|
|
In C#, I would have the list stored somewhere, and then use delegates to access it in other forms, I'd avoid having globals if I could help it ( I avoided it in C++ as well )
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I'm trying to paint some extra info on to a rtb control and the only way to do so is by setting ControlStyles.UserPaint to true so the Paint method gets called, but slight problem since its all user drawn the text doesn't get drawn How do i get around this?
Thanks
|
|
|
|
|
You could call the base OnPaint method from your code.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
When i call the base.OnPaint method it throws an error, and when i single step through it once the base.OnPaint method is called it loops back to the begining of my Paint handler. Im guessing this is because ControlStyles.UserPaint is set to true but that is the only way the rich text box will allow any paint handlers to be called.
|
|
|
|
|
I would like to capture POST data from a local web form displayed in a .NET WebBrowser control.
In activeX browser you can use the "BeforeNavigate2 event" to capture POST data and the entire HTML header, but I only see the cancel flag and target frame name in the .NET 2.0 control.
Does anyone know how to capture this data in .NET?
|
|
|
|
|
HI,
Win32 Class Example : Win32_BIOS
is there any way to get the list of those classes
from the system (not manually)
Have Fun
Never forget it
|
|
|
|
|
Is this a C# class ? If so, you can use reflection. If not, then no.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
THANKS
Have Fun
Never forget it
|
|
|
|
|
That's a WMI class. You'd have to use WMI methods, and the .NET BCL System.Managment namespace classes to do this. I can't remember how, because I haven't done it in about 10 years, but it is possible to do. CIM_Studio does the exact same thing.
|
|
|
|