|
Not sure if its possible, but I have no idea why you would want to do it this way? You could just do an if/else sending execution to the proper method or if you end up having more than two options use a switch. Also, instead of a string use an enum. You are looking for a finite number of specific values (in this case 2, "HORIZONTAL" and "VERTICAL") by using an enum you force callers to pass valid values.
public enum Direction
{
Horizontal,
Vertical
}
public class Bar
{
public Bar(int x, int y, Direction dir)
{
this.x = x;
this.y = y;
if (dir == Direction.Horizontal)
UpdateHorizaontal();
else
UpdateVertical();
}
}
|
|
|
|
|
Can any one plz make a regular expression for me:
The input string is of the form:
BLAH BLAH ^##$[FRUIT]APPLE[/FRUIT] #$&&^*^%&^$%#@$ BLAH BLAH
I want to extract [FRUIT]APPLE[/FRUIT] from the above string firstly using Regex. After that i want to extract APPLE from [FRUIT]APPLE[/FRUIT] using Regex.
Can someone plz help me writing regular expression for this pattern. I am trying but ending in failure may be because of the presence of Big bracket '['
Imtiaz
|
|
|
|
|
use \[ and \] to insert the brackets. Google Expresso and download it, it's invaluable in these situations.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
You don't need a regular expression to extract APPLE from [FRUIT]APPLE[/FRUIT].
string fruitType = fruitTag.SubString(7, fruitTag.Length - 15);
---
b { font-weight: normal; }
|
|
|
|
|
hi
u can use a tool like expresso to do some more RND on regular exp. It will guide u to write regular expresion. After that go to Tools/View Code it genearte ur C# code for that exp.
u can dowload this from . Its free
http://www.ultrapico.com/Expresso.htm
Regards.
|
|
|
|
|
\[FRUIT\](.+)\[/FRUIT\]
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hello I've been googling for what seems like days now and can't find an answer to what I would think would be an easy thing to do. I have an application that uses a web browser to do a few automated tasks which I have programed. The browser has various sounds are generated and I want to be able to mute the volume of it.
My program doesn't have any need for volume at all so I really just want a way to mute the volume of my entire program. I read a ton about how to control the windows mixer but this doesn't include application specific volume control.
Is there any way to control the application volume and not affect anything else in the system?
btw, I'm using the AxSHDocVw.AxWebBrower for my browser
Brett Nottingham
|
|
|
|
|
From what I read application volume control will only be implemented in Windows Vista (see this[^]), which means it is not implemented in previous versions of Windows. So the answer is no.
However, I found this[^] which seems to be doing what you requested.
"A democracy is nothing more than mob rule, where fifty-one percent of the people may take away the rights of the other forty-nine." - Thomas Jefferson
"Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." - Benjamin Franklin
Edbert
Sydney, Australia
|
|
|
|
|
When i first started to learn about the binary system i always ended up learning that to count in binary you work from right to left. 128,64,32,16,8,4,2,1. But while looking at the Netflow packet 9 format from cisco. (http://www.cisco.com/en/US/tech/tk648/tk362/technologies_white_paper09186a00800a3db9.shtml) it shows the field bit positions starting from left to right. [0,1,2,3,4,5,6,7]. how to I align up those bit values? does bit position 7 have a value of 1, or 128? or does this not matter since i am reading my data from a byte array and then i could just use the convert.tostring(2,byte) to view the binary data and the resulting string would be in the format of 128,64,32,16,8,4,2,1? thanks. hopefully i'll figure this out soon so i can get to sleep before 3am like last night!!
|
|
|
|
|
</asp:textbox><asp:radiobuttonlist id="RadioButtonList1" OnSelectedIndexChanged = "VisibilityControl();" style="Z-INDEX: 110; LEFT: 208px; POSITION: absolute; TOP: 144px"
runat="server" Width="73px">
I get compile error when I try adding the visiblitycontrol() function to the selected index change event of the radio button list. Any hints?
-- modified at 19:21 Wednesday 4th October, 2006
|
|
|
|
|
I'd have thought the correct syntax would not involve brackets or a semicolon.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Can someone tell me what I am doing wrong with the following code? It is supposed to create a set of sub menu items, under "Plot RPM" menu item. It works the first time it is called. But if I call the code the second time, using the same set of parameters, I can't see any the sub menu items. But I can see an arrow that denotes the existence of sub menu items. If I display myMenu.MenuItems.Count, it returns the correct number of sub menu items. Stranger still is that if the number of sub menu items is 1, it is ok. Any help on this matter is greatly appreciated.
Thein
<pre>
MenuItem myMenu=null;
foreach (MenuItem myMenu1 in this.My_Context_Menu.MenuItems)
{
if (myMenu1.Text == "Plot RPM") // check for menu item
{
myMenu = myMenu1; // found, assign to temp menuitem
break; // exit loop
}
}
if (myMenu.Text == "Plot RPM") // double check just in case
{
myMenu.MenuItems.Clear(); // clear all define rpm source list
for (i=0; i<myNewMenuItemCount; i++) // add list
{
{
MenuItem myItem = new MenuItem((i+1).ToString() +" " + myMenuID[i]);
myMenu.MenuItems.Add(myItem);
}
}
}
</pre>
Thein
|
|
|
|
|
I can't thought a better subject . Sorry for that.
Anyway. Can I load a user controls in win forms like I can do in ASP.NET?
Control c = this.LoadControl("control path");<br />
....
Or there is a better way to add a controls on panel if we consider that I store in xml file which user control is to be places on which panel?
Something like adding modules.
|
|
|
|
|
Hi,
In win forms you can add a control inside a panel using something like in the example below.
Suppose you have created a user control named MyUserControl and you have a panel on your form named PanelControls
private void FormMain_Load(object sender, System.EventArgs e)
{
MyUserControl c = new MyUserControl();
PanelControls.Controls.Add(c);
}
Hope that helps you.
Do your best to be the best
|
|
|
|
|
You've missunderstand me.
Adding controls to a panel or any control container control isn't an issue.
I asked can I somehow load a control from file name like I can do in asp.net with LoadControl function?
I have stored modules in xml file and in xml file is also where which controls has to be placed in which control container, so I have to read from xml to add a control to a control container.
In asp.net I will do that by storing the file name to the module (control) and then use the code below:
Control c = this.LoadControls("control path");<br />
c.ID = "what ever";<br />
ControlContainer.Controls.Add(c);
I want the same functionalaty in win forms, if this is possible, and if is, how?
I hope you understand...
Thanks.
|
|
|
|
|
Greetings!
I have a set of 6 RadioButtons, one of which is set based on a user-selection in a ListBox on the same form.
What I want to do is to disable the other 5 RadioButtons after the user makes the selection and one RadioButton is set.
I'm assuming that a collection is the best way to do this, so I can write some code that disables every RadioButton that is not the one that is selected.
Could you help me define this Collection? I've looked through MSDN and pages online but I'm a little confused about how one defines a collection.
Thanks!
|
|
|
|
|
In page_load or where you initialize your variables do:
List<RadioButton> buttons = new List<RadioButton>();
buttons.Add(RadioButton1);
buttons.Add(RadioButton2);
buttons.Add(RadioButton3);
buttons.Add(RadioButton4);
buttons.Add(RadioButton5);
buttons.Add(RadioButton6);
Then you can iterate throug them with loops:
foreach (RadioButton rb in buttons)
{
if(!rb.Checked)
rb.Enabled = false;
}
|
|
|
|
|
|
I have a form with a tabControl with two pages. On the second tab page is a textbox(txtMLBox_ID). I need to reference it from a module in another part of the application but can't seem to get the reference syntax correct.
Namespace: LabelTool
Form: MainForm (also in LabelTool ns)
tabControl: tabControl1
tabPage: tabMultiRuncard
textbox: txtMLBox
Attempting to access from:
MultiLotRC.cs which is also in the LabelTool ns
I thought that MainForm.tabControl1.txtMLBox.ToString() would work but I'm pretty rummy from trying every purmutation I can think of.
This probably is not a difficult as I'm making it. Progamming in C# (vs2005)
TIA
Tom Hamilton
|
|
|
|
|
I believe the controls generated by the designer is marked as private, which means if you want to access it from somewhere else you need to create a property that returns your control.
"A democracy is nothing more than mob rule, where fifty-one percent of the people may take away the rights of the other forty-nine." - Thomas Jefferson
"Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." - Benjamin Franklin
Edbert
Sydney, Australia
|
|
|
|
|
Thank you Edbert,
(I'm very new to Object Oriented) Are you suggesting I do the get/set for a property then reference it?
Tom Hamilton
|
|
|
|
|
Yep. Do a get property (I don't think you need to create a set property) in order to be able to access the control within the form.
Otherwise you can also change the control's Modifiers through the form designer from private to public.
Hope that helps.
"A democracy is nothing more than mob rule, where fifty-one percent of the people may take away the rights of the other forty-nine." - Thomas Jefferson
"Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." - Benjamin Franklin
Edbert
Sydney, Australia
|
|
|
|
|
I have a form wich was divided into 16 pictureboxes. There is absolutly no room beetwen each other or them and the form. When i enlarge them they all enlarge downwards and to the left So the ones on the bottom and left side of the form, when they get enlarged, only a part of them appear(the left up side) how do i correct this??
rzvme
|
|
|
|
|
You can set the anchor properties to set how they resize when you resize your form.
Overall, I'd say you'd have more control if you drew your own bitmaps, although using a picturebox is certainly easier.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
i'm not resizing the form...i just want to resize them when an event is fired
rzvme
|
|
|
|