|
I am definately using Size, not ClientSize. I also believe it is the height of the menu bar that is being added to the form, not the height of the title bar.
|
|
|
|
|
Hello,
I have 11 instances of a control (representing 11 audio channels). This control has, among others, two public boolean properties called SOLO and MUTE. These can be turned on and off by means of two checkboxes, say, chkSolo and chkMute.
This is what I need to do:
1) If the user decides to "solo a channel", i.e. set the SOLO property on one of the controls to TRUE, the MUTE property of the other 10 controls should be set.
2) Unchecking the chkSolo box (setting SOLO to FALSE) should "unmute" the other 10 controls.
What's the best way of doing this? Should I have a collection of controls? How do I identify which of the controls is being Soloed?
Thanks for your help!
|
|
|
|
|
I'd say the best way is to create 2 user controls.
The first control should contain the channel, the checkboxes Solo and Mute. Let's call it Channel.
When chkSolo is clicked, the control should raise an event to notify it.
The second control should handle the collection of the first controls. Let's call it Mixer.
This control should handle chkSolo click event (preferably a custom event returning your Channel control); Everytime a chkSolo is checked, it needs to save (either the Channel control's index or a reference to the Channel control) which of the channel control is checked, and if it is to be soloed to go through the collection and mute the rest of the controls. If it is to be unchecked the rest of the controls should be unmuted.
Therefore, your Mixer will have handled the mute/unmute and you can get the control being soloed (if any) from it.
Edbert
Sydney, Australia
|
|
|
|
|
Edbert, thanks for your reply! Could you give me an example of what the code for the event and the second control (the collection of controls) should look like? Just an example would be great.
Thanks again!
|
|
|
|
|
Here's a small example (I'm blind coding, it might have some syntax error):
For Channel, you need to raise an event whenever the checkbox is checked:
public event SoloChangedHandler SoloChanged;
public delegate void SoloChangedHandler(Channel sender);
private void OnSoloChanged()
{
if (SoloChanged != null)
SoloChanged(this);
}
private void chkSolo_Checked(object sender, EventArgs e)
{
OnSoloChanged();
}
public bool IsSolo
{
get { return chkSolo.Checked; }
set { chkSolo.Checked = value; }
}
For Mixer, you need to either keep a reference on the selected Channel, or the index, or both:
private int selectedIndex = -1;
private Channel selectedChannel;
private void ctrlSolo_SoloChanged(Channel sender)
{
if (sender.IsSolo)
{
this.selectedIndex = this.Controls.GetChildIndex(sender);
this.selectedChannel = sender;
foreach (Channel channel in this.Controls)
{
if (channel != sender)
{
channel.IsSolo = false;
channel.IsMute = true;
}
}
}
else
{
this.selectedIndex = -1;
this.selectedChannel = null;
foreach (Channel channel in this.Controls)
{
channel.IsSolo = false;
channel.IsMute = false;
}
}
}
That's it. Now you just need to add properties to access the collection of Channels, the SelectedIndex, and the SelectedChannel.
Hope that helps!
Edbert
Sydney, Australia
|
|
|
|
|
I want to make a program to view some XML files. Right now just looking at the files is very confusing and intimidating to most people. I would like to make it more intuitive and easier to work with (the xml).
I'm in a planning phase right now, and was wondering what would be he more graceful way of doing loading the XML? I just want to do it with style.
The xml files are like this..
1 "package" root node
any number of "method" nodes
- one "paramlist" node per method
- any number of "params" per "paramlist"
- one "actionlist" node per method
- any number of "action" nodes per actionlist
that's pretty much the XML each node has few attributes too. I need to make a schema for it too.
So what would be the best way to convey the XML to a user? The only thing I can think of is a tree control. Any other ideas?
So how would I load the xml file each time? how would I save it from the tree?
I'm thinking seralization, does that sound right?
/\ |_ E X E GG
|
|
|
|
|
I'm trying to find a way to use the sql builder to make custom searches.
Basically I have a textbox that is for "item" and I'd like the content of that string used for a WHERE sql command. I can't figure out how to do this with the query builder though. Thanks!
|
|
|
|
|
No Idea's how to modify the stored SQL from Query builder using a custom string that can be build from a form object? :[
|
|
|
|
|
we are deploying a winforms application using ClickOnce (OnlineOnly)
how can i uninstall it?
any pointers in the right direction would be very much appreciated
|
|
|
|
|
c:\windows\downloaded program files\(your app to delete here)?
I'm assuming it would install something like shockwave or flash. If so, you can just delete the file in the folder above.
|
|
|
|
|
Hello I have the following error with VS2005:
"the following module was built either with optimizations enabled or without debug information..."
It just comes up from nowhere while i was debugging my program.
It just pops up whenever i try to run my program which is composed of 2 projects. I have an application project and a main project. With that warning any changes in the main project are not updated in the solution.
I tried to change the property to debug and it's not working. I tried to detach the main project and readd it back to the solution and it's not working. I also made sure that the application project refere correctly to the main dll in the main bin.
I try to look around and some people do have this kinda problem but it's more related to deployment which is not my stage yet.
Can anyone tell me what's going on?
Donkaiser
|
|
|
|
|
To debug this module, change its project build configuration to Debug mode. To supress this message, disable the 'Warn if no user code on launch' debugger option.
--
I've killed again, haven't I?
|
|
|
|
|
Where is the "warn if no user code on launch"?
Donkaiser
|
|
|
|
|
well I found the option. but i still need to manually remove the reference in my application and reAdd it after change in the main project. before after any changes in the core, all i needed was to rebuild the solution to make it work.
Donkaiser
|
|
|
|
|
I am not sure what created this error.
but the error which I got in my c# application says "Windows form exception Error creating windows handle". I dont know whether it exceded the number of handles but I am surprised that limit is atleast 1000 and I dont have 1000 controls on my form.My application has single form and
one tabcontrol with 7 tabpages. There are many callback event firing in the application these events populate the listboxes on each tabpage. I read it in some message forums that controls on tabpage does exceed the number of windows handle used. IF anyone has any idea about this issue please let me know.All responses will be highly appreciated.
Mandar Patankar
Microsoft Certified professional
|
|
|
|
|
Can you post the complete error message (i.e. the one in Exception.ToString() so that we can see what was being called)?
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
Thanks for replying ed.
this is the error message
An unhandled exception of type 'System.ComponentModel.Win32Exception' occurred in system.windows.forms.dll
Additional information: Error creating window handle.
this error is random. Application works fine for some time and suddenly when you are switching between tab pages this error is raised.
Mandar Patankar
Microsoft Certified professional
|
|
|
|
|
Have you tried running it inside the debugger and investigating the current state of the variables. Take a look at the stack trace as well if possible (this should be included in the exception text). You'll just have to experiment and try and find out if there are any common things occurring at the same time as the exception (such as an object being null, stack overflow etc).
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
Ed,
thanks for your response but I figured out the problem. I was running some background threads in my application and these threads were updating the windows controls like listbox and textbox.So, if user clicks on the form while these threads are updating these controls a exception was raised. The solution which I figured out and probably works fine is updating controls using delegate invoke from background threads. Common example of using methodinvoker and creating static object of the form class.
Thanks
Mandar Patankar
Microsoft Certified professional
|
|
|
|
|
That's OK it's nice to hear back that someone managed to solve the problem.
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
Hi friends
If i want to code a big project in c# in VS2005 which road must i follow?What do you advice me?
Especially i want to design it with plugin support.I write it skeleton, then other parts will be plugin or it can be developed by other coders.I want to learn what must i prepare before start coding.How must projects settings be for plugin support or for a such a big project.(For great extensibility)
I am looking for your answers.Any links , articles, advices will be very useful for me.
Thanks..
|
|
|
|
|
I'd recommend the following things (in order)
Read Tim's article on Divelements http://www.divelements.com/net/articles/plugins/plugins.asp[^] It's the first one I read and was (still is but not as good now that he doesn't provide free controls anymore )
Take a look at the SharpDevelop[^] code if you need ideas for a really big project.
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
is it possible for me to convert a strig to a string array in c# and if so how??
beginner in C#
|
|
|
|
|
String has the Split method, which should be what you are looking for.
josh
|
|
|
|
|
yes andi normally use the split function for example
if i hava a string="walk,keny,go"
i will get all off the values like walk or kenny or go by setting the delimeter to ","
but supposei have a string="lets walk to the suppermarket"
is there anyway for me to access each character by themself for example i know if i was puting this in an array. array[o] would be l and array[1] would be e
???? u have any idea how i could do this? or any link to any example if it might be too tediuos to show me how to do it?????
beginner c#
|
|
|
|