|
Pen[] penArray = new Pen[] { new Pen( Color.Blue ), new Pen( Color.Black ) };
Human beings were not meant to sit in little cubicles staring at computer screens all day, filling out useless forms and listening to eight different bosses drone on about about mission statements. -- Peter Gibbons
|
|
|
|
|
|
There seems to be no direct way to databind to a StatusBarPanel; I've run across some incomplete code samples that advises using a method to create a property for the statusBarPanel and then use the new property to databind to the dataset. The problem is I don't know how to proceed from there. Any help greatly appreciated.
Code Snippet ==========================================================
public string StatusBarPanel1Text
{
get
{
return statusBarPanel1.Text;
}
set
{
statusBarPanel1.Text = value;
}
}
|
|
|
|
|
In you Form do the following
StatusText st = new StatusText();
st.StatusBarPanel1Text = "HELLO";
this.statusBar1.DataBindings.Clear();
this.statusBar1.DataBindings.Add( new Binding("Text", st, "StatusBarPanel1Text"));
Declare the class
public class StatusText
{
private string str;
public string StatusBarPanel1Text
{
get
{
return str;
}
set
{
str = value;
}
}
}
|
|
|
|
|
Hi,
Thanks for responding to my issue; I tried your suggestion and it doesn't seem to work for me. I get no errors but the statusBarPanel remains unaffected.
|
|
|
|
|
I'm trying to modify one of my company's deployment projects. I've added a dialog to prompt the user to enter a server name. But I don't know how to get this value and do anything with it. Also, I'm trying to find any way to actually change the design of the dialog, is there a way to do this? Any help or links to good tutorials would be appreciated. Thanks in advance.
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
BlackDice wrote:
I've added a dialog to prompt the user to enter a server name.
Have you done this via adding a "Textboxes" user interface window to the User Interface screen? If so, go to the properties window and you will see, in addition to BannerBitmap, BannerText, and BodyText, 4 possible edit values.
Each of the 4 edit values have a label, a property name (use this to then retrieve the input at a later time), and a boolean visible. You can make 3 of them invisible if you only need the first one. You will notice in Edit1Property, the default value is "EDITA1"
So for instance, if you are wanting to do something with the server name during the "Install" phase, you would do the following:
(1) Add a class library to your setup project's solution;
(2) Mark that class as an installer project through an attribute (MSFT[^])
(3) Open the Custom Actions editor window, and right-click on Install
(4) Add your output for your class library
(5) Get the Properties for that new entry under Install, and look at the CustomActionData field.
(6) Add a string to pass in such as /f1=[EDITA1]
Back in the class...
(7) Override the Install method
(7a) Call base.Install()
(7b) Call Context.Parameters["f1"] to get the value
That may not be completely accurate, but may give you more stuff to search for on google.
|
|
|
|
|
thanks for your reply. I got most of that accomplished Friday right before I left work. I did finally find some stuff after Googling enough. Now the only problem I'm having is finding out how to disable the 'next' button if the textbox is empty. according to one page I found online, there should be a 'condition' property for the dialog, but I don't see one. and I don't want to do it as a custom action in the overridden 'Install' method, because that's too late in the process. any other suggestions or help will be greatly appreciated. thanks !
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
Well, I have 2 thoughts.
The first would be using ORCA, which is a free tool from Microsoft. What this is, is this allows a compiled msi file to be opened up and edited. It's like a database tool.
I was poking around and I saw 2 tables that might be useful: Control, and ControlCondition. My theory is to add 2 rows to ControlCondition. The values would be as follows:
(1)
Dialog: CustomTextA
Control: NextButton
Action: Disable
Condition: CustomTextA_EDITA1="" or EDITA1=""
(2)
Dialog: CustomTextA
Control: NextButton
Action: Enable
Condition: CustomTextA_EDITA1<>"" or EDITA1<>""
I tried to test this theory, but I couldn't get it to work. Maybe you can play around with this.
My second theory was to use custom actions. During Install, you can actually pop up a modal dialog custom form. You can do anything you want at that point, including cancelling installation. You just use it like a regular windows form. You mentioned that may be "too late" in the process, so I'm not sure what it is that you "need" beforehand that would force you to know before the install method initializes.
Hope this helps at all.
Oh, and you can get ORCA here[^].
|
|
|
|
|
I also downloaded the sdk the other day to get orca. I can view all that stuff and I already tried to change two rows that were in there (that didn't help). But I didn't try to add my own two rows. I will try that and see if I can get it to work. BTW, this dialog asks for the name of the server where the user's SQL Server db is located. If it's empty, I don't want them to be able to go to another dialog, then click 'Install' before telling them they need to enter a server name. I'll try your suggestion and see what happens. Thanks again!
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
OK, your theory worked!!! (I had to use EDITA1 instead of using the dialog name also). But the only problem now is that if the user puts in a space, it still accepts it as being filled. But what are the chances of the user putting in a space?.....yeah, right! gotta see if I can find a way to trim what they have. You've been a great help. thanks!
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
Excellent! And I think you can use relatively complex conditional statements. Give this MSDN link out a try: Contitional Statement Syntax[^].
Good luck, and glad I could help.
|
|
|
|
|
Do i have to set an ArrayList declaration to null in the deconstructor? If not why? Please help.
Nana
|
|
|
|
|
|
Deconstructor in c# ???? I think Managed code in .NET as Garbage Collector. And ArrayList is part of managed Code but i dont know if that garbage is collected. You can try something like doing a loop in that you declare a new ArrayList with some elements. Run it. Then go to Windows Task Manager and if the memory of your program doesn't stop climbing then its because that garbage isnt collected. Put some "big" elements in Array List.
If not try to set ArrayList to null as you say and try again.
Bye.
pharaoh
|
|
|
|
|
If you create a lot of ArrayList objects in a loop, they will not be garbage collected unless you run out of memory. The garbage collector will run when other programs are idle, it will not run while your loop is running, unless absolutely neccesary. Also, the garbage collector collects the oldest objects first, the objects that you just created will be collected last.
---
b { font-weight: normal; }
|
|
|
|
|
Also destructors do exists in C# .NET. They are compiled into Finalizer method in the IL.
If one thinks that by the timeGC to start its next collection, the application runs out of memory, GC.Collect() could be handy. But I would always try to avoid it. As a matter of fact I have never used it.
|
|
|
|
|
Guffa wrote:
they will not be garbage collected unless you run out of memory.
That's not true, they will be collected before you run out of memory. They will be collected whenever the garbage collector deems necessary, which isn't always when you run out of memory.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Cops & Robbers
Judah Himango
|
|
|
|
|
Guffa wrote:
If you create a lot of ArrayList objects in a loop, they will not be garbage collected unless you run out of memory.
That's not the entire truth: GC will also run before it tries to allocate more memory.
|
|
|
|
|
The ArrayList itself is a managed class. Just let it go out of scope, and it will be gracefully garbage collected.
If the ArrayList contains references to unmanaged resources, you have to dispose of these resources when your class is disposed. You should implement the IDisposable interface if your class handles unmanaged resources.
As the ArrayList may contain references to other objects, call the Clear method when you don't need the list any more. If the ArrayList doesn't contain references to other objects, it will be easier for the garbage collector to remove it.
---
b { font-weight: normal; }
|
|
|
|
|
Hello !!
I've been programing in Visual Studio 2003 and now i change IDE to Visual Studio 2005 Beta 2 and of course .NET 2.0 Beta. I converted the project i was doing and i run it. It show lots of runtime errors of Thread Safe because it looks like Windows.Forms is no longer a Thread safe operation (why have they change this???? don't have a clue). How can i call these objects in another thread? i know it has something to do with "Delegate" or "control.Invoke" but i think this has change too.
Please help me.
thanks !!
Sorry for my English...
Bruno Conde
pharaoh
|
|
|
|
|
The operations that you speak of were allow to be written in kind of a shortcut fashion in 2003, but shouldn't have been. You have to rewrite the code to follow the more strict threading rules of 2005.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
Windows Forms has NEVER been thread safe! In fact, Win32 common controls have never been thread safe. Even the new UI coming in Windows Vista is not thread safe. In .NET 1.1, the application would run ok for awhile, but you'd run into subtle bugs eventually. In .NET 2.0, a error is issued if you try to use Windows Forms controls from another thread.
If you want to use a Windows Forms control from another thread, use the Control.Invoke and Control.BeginInvoke methods:
void CalledFromAnotherThread()
{
myTextBox.Invoke((ThreadStart)myTextBox.Invalidate);
}
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Cops & Robbers
Judah Himango
|
|
|
|
|
Hi,
I want to be able to mute and unmute sound in Windows from my C# app. However, I have no idea where to start. Can someone give me some good links or sample code?
Thanks in advance
|
|
|
|