|
Has anyone managed to impliment NUnit testing on an Excel plugin project using Add-In Express ? I can write the tests, but I can't get an instance of Excel to work with.
Sorry if this is not the correct forum.
Johan Lombaard
Only two things are infinite, the universe and human stupidity, and I'm not sure about the former - Albert Einstein
|
|
|
|
|
Hi,
in my application (.NET 1.1, Windows.Forms) I have built a progress bar form, which is started in its own thread. It gets the progress information from the main thread and is thus successfully redrawn during the calculations - when it is kept on the top.
My problem refers to the window instances: I want the progress bar form to be always on top of the main form, but that seems not to be easy. It always shows up on top of the main form, when I define the main form as its owner, but then the progress-bar form is not redrawn during the calculation. At the moment I have it not defined as owned by the main window, but when I now bring another window on top and then want to change back to my, still calculating, application by activating it on the task-bar, the progress-bar window is invisible under the main window.
I hope, you understand my problem... What do I do wrong? Is it not allowed to define a form, which was created in an own thread, as owned by a form created in the main thread?
Thanks in advance,
Alex
|
|
|
|
|
Hello,
Have you tried the "TopMost" property of the Form?
All the best,
Martin
|
|
|
|
|
Thanks for the hint, I tried it and it works as expected, but that would be just a workaround, I think that the user will be annoyed by such a status window (I would). Is there another chance to make this window on top of my program´s windows?
|
|
|
|
|
Hello,
Maybe you like:
BringToFront();
SendToBack();
All the best,
Martin
|
|
|
|
|
Unfortunately this also does not work. With each progress update I execute:
this.BringToFront();
this.MainWindow.SendToBack();
this.Focus();
Console.WriteLine("Forcing to front..." + DateTime.Now.Ticks.ToString());
This is continually executed, but I still can only make the progress window visible by minimizing other windows
|
|
|
|
|
Hmm...
Would it be an option if you use ShowDialog from MainForm to show ProgressBarForm?
All the best,
Martin
|
|
|
|
|
I am already using ShowDialog from a special class I created to implement starting the second thread. But when I use the overload providing the "owner" I get the same result as when defining the owner "manually".
I´ll have to correct me: The problem which I encounter when I define the owner is that however the progress bar is redrawn, but the buttons on the progress form cannot be clicked (do not fire an event) as well as the whole form cannot be moved with the mouse, it sticks on the owner form and does not react.
|
|
|
|
|
Hi,
you dont need a separate thread to show a progress bar.
you could call Application.DoEvents() every time you update the progress, but I do not
recommend that, it is a hack/ugly/not descent/whatever.
You would be better of using another thread to do the lengthy calculation,
and let the main thread (aka GUI thread) show the progress bar; to get it on top,
make it a form owned by your main form.
To communicate from your lengthy calculation thread towards the progress bar, you would
need Control.Invoke if that thread holds the update-progress initiative. I often do it
the other way around: have a Forms.Timer periodically interrogate the calculating thread
about its progress (e.g. use a property of your job object) and update the progress bar.
|
|
|
|
|
|
Hm, this class is Framework 3.0 specific.
|
|
|
|
|
Nope, it was added in .NET 2.0.
|
|
|
|
|
OK, still too new
|
|
|
|
|
My question is based on functionality in Masked Textbox control which is available only in .Net framework 2.0 onwards. I want the kind of functionality provided by MaskedTextbox control but I can't use this control as I'm currently working on framework 1.1.
So I have decided to make one for me on my own. I derived the control from Text box. I was able to implement Mask dialog and validations but stuck up with text property implementation of control.
For the Masked Textbox, if you implement telephone no. mask with format (___)___-____, then text property value initially will be blank. But on the form, Masked TextBox text will show format i.e. "(___)___-____". Also, if I write 333 in property grid for text property then in property Grid I will be able to see value as "333" while in the Control on the form it will display me a text like "(333)___-____". So in a way two different values for the same text property in property grid and control. So this is bit confusing and don't know how to implement this thing in a same way as provided by Masked Text box.
I tried to implement this by overriding the text property and giving different implementation for design time and run time. But its not helping me.
Can anyone help me by providing some ideas on how to do above things. I hope I'm clear with my question. If reading above, you are not clear about the question pls write back to me or check the working of Masked Textbox control for better understanding.
Regards,
KC
|
|
|
|
|
Hello,
I think in that case only a workaround does the trick!
Because Text property of TextBox seems to be special case.
Therefore I would use an additional "newText" property and hide the "Text" property.
private string _newText="";
[DefaultValue("")]
public string NewText
{
get
{
return _newText;
}
set
{
if(value!=_newText)
{
_newText = value;
Text = _newText+" I'm formated";
}
}
}
[Browsable(false)]
public new string Text
{
get
{
return base.Text;
}
set
{
if(value!=base.Text)
{
base.Text = value;
}
}
}
Hope it helps!
All the best,
Martin
|
|
|
|
|
Hi,
I'm starting to read up on serializing my classes using XML, seems really useful but depending on which article I read opinions vary on whether ArrayLists can be serialized. Does anyone know for sure whether they can or can not? It seems as though it changed from 1.1 to 2.0, but I cant tell for sure.
Thanks
|
|
|
|
|
It has changed from .NET 1.1 to .NET 2.0, as far as I know you can serialize List<T> in .NET 2.0
Another method is the mark the list with the [XmlElement] attribute, to make sure it gets serialized correctly.
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
My blog
|
|
|
|
|
Hi,
i am developing a text editor for windows forms in c#. i would like to know how to add bullets and numbering. I have added the following code.
<br />
rtbDoc.BulletIndent = 10;<br />
rtbDoc.SelectionBullet = true;<br />
but it gives only 1 type(circle) of bullets. But i have to show square type bullets and numbering...
will you please give some guidelines...
Thanks in adavnce
Sebastian
|
|
|
|
|
Sebastian T Xavier wrote: i am developing a text editor for windows forms in c#.
Looks to me as if you are just using the RichTextBox. That isn't "developing a text editor". Someone else has already developed it, you are just putting it in a form.
Sebastian T Xavier wrote: but it gives only 1 type(circle) of bullets. But i have to show square type bullets and numbering...
will you please give some guidelines...
If you were genuinely "developing a text editor" you would be able to do what ever you wanted. So, actually do what you say you are doing.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
AFAIK there is only one bullet style in RTB.
|
|
|
|
|
|
Hi!
The RichTextBox actually can do a lot more than you can access with the built-in methods and properties.
Underneath the .NET wrapper there's a RichEdit control (version 2) you can send windows messages to (read about rich edit control messages in MSDN) to achieve several nice effects like different kinds of numbering, underline styles, superscript/subscript and several others.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hello all,
I'm very frustrated with a bug that I can't seem to beat. I'm using Activator.CreateInstance to create an array of objects based on a sampleObject. Each instance of SampleObject contains a uniqueid which is generated randomly in the constructor. Something like this:
<br />
SampleObject sampleObject = new SampleObject();<br />
SampleObject[] array;<br />
<br />
<cut other stuff><br />
for (int i = 0; i < numberToCreate;i ++)<br />
array[i] = Activator.CreateInstance(sampleObject.GetType());<br />
<br />
<cut rest of code><br />
Now, when I run this in the VS debugger it works fine and I get a proper batch of unique objects. However, when I run the code outside of VS, all the objects have the same uniqueid!
Anyone out there have any idea what is going wrong or more importantly how to fix it
TIA
|
|
|
|
|
I tried something like this, and it worked perfectly. My thoughts:
1. Are you sure you're running the same code outside of VS? Maybe what you're running from outside is an older build.
2. You haven't shown us the ctor logic. When the ID is generated in the constructor, try printing it or logging it to a file, for debugging purposes.
3. Aggressive compiler optimization settings may be interfering with your program logic. Try running it without optimizations.
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
Hello Vikram,
Thanks for responding. I have verified that I am not running the latest build, etc. I also tried with optimisation disabled.
Here is my Constructor:
public class MyDerivedObject : MyBaseObject
{
public static int NUMBER_OF_DIMENSIONS = 2;
double uniqueID;
public MyDerivedObject() : base(NUMBER_OF_DIMENSIONS)
{
uniqueID = base.RandomGenerator.NextDouble(); // generate uniqueID
Console.WriteLine("uiqueID: " + uniqueID.ToString());
}
}
Thanks again
|
|
|
|