|
Hi, I'm wondering if there are any differences between the System::Byte type , unsigned int and the unsigned char in terms of structure and performance?
They are all 8-bits long, am i correct?
Thanks
|
|
|
|
|
bankai123 wrote: They are all 8-bits long, am i correct?
No. an int is definately not 8 bit. What made you think that ?
int is 32 bit.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
woops, my mistake , so what are the differences between the System::Byte and a unsigned char?
|
|
|
|
|
I'd be astounded if there were any.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
This table might be of use, in C# chars are 16 bits.
|
|
|
|
|
Hi...I'm trying to develop a generic "Bar" class inside XNA and thought I would investigate a method(development method....not a literal C# "method") of accomplishing this and was hoping that someone might be interested as well.
What I am wanting to do is pass an "OrientationString" through the constructor and conditionally compile the update methods based upon this string. (I know that I could accomplish this task through inheritance....but that's one of the reasons why I'm not doing it that way)
The functionality I desire is:
I know the following code will not work...please don't reply saying as such
because I already know that. It is pseudocode
#undef HORIZONTAL
#undef VERTICAL
public Bar(int x, int y, string OrientationString)
{
this.x = x;
this.y = y;
#if(OrientationString.ToUpper().Equals("VERTICAL"))
{
#define VERTICAL
}
#elif(OrientationString.ToUpper().Equals("HORIZONTAL"))
{
#define HORIZONTAL
}
}
[Conditional("VERTICAL")]
public void UpdateVertical()
{
...
}
[Conditional("HORIZONTAL")]
public void Update HORIZONTAL
{
...
}
I basically want to control conditional compilation at run-time(*scratches head*......did I just say that?)
Does anyone know of a way to represent this logic in C#? I investigated the Attribute class but couldn't get very far with it.
-- modified at 23:58 Wednesday 4th October, 2006
|
|
|
|
|
First question that arrises is: Why do you want to do that? Can't you just include both methods in the application? This is most likely not possible to do in C# or any language for that matter.
WM.
What about weapons of mass-construction?
|
|
|
|
|
|
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;
}
|
|
|
|