|
How to in C# detect Dial-up connection ? and how to recognize dial-up number?
How detect that some program try use Dial-up?
Greetings
S_W
|
|
|
|
|
Can someone advise me on how to convert hex conversion in C#? I am currently trying to get the string in a textbox, say "20" and convert it to its hex form 14, and then display it onto another textbox.
Weiye, Chen
When pursuing your dreams, don't forget to enjoy your life...
|
|
|
|
|
From help (I did something similar to this) :
Console.Write("{0:X}", 250);
I'm not sure if you can do that directly to a string or if you need to use a StringBuffer class like I did.
This is some code how I retreived color codes in individual colors (in bytes) and converted them to hex strings.
<br />
StringBuilder oBuffer = new StringBuilder();<br />
string strColorCode = "";<br />
byte byRed = 0;<br />
byte byGreen = 0;<br />
byte byBlue = 0;<br />
<br />
<br />
byRed = oColor.R;<br />
byGreen = oColor.G;<br />
byBlue = oColor.B;<br />
<br />
strColorCode = "{0:x2}{1:x2}{2:x2}";<br />
oBuffer.AppendFormat(strColorCode, byRed, byGreen, byBlue);<br />
<br />
return oBuffer.ToString();<br />
There are only 10 types of people in this world....those that understand binary, and those that do not.
|
|
|
|
|
I just found out how to do the conversion, thanks to your format string :
strColorCode = "{0:x2}{1:x2}{2:x2}";
This is what i did :
short sh = System.Convert.ToInt16(tbTextBox.Text, 10);<br />
tbTextBox2.Text = String.Format("{0:x2}", sh);
Weiye, Chen
When pursuing your dreams, don't forget to enjoy your life...
|
|
|
|
|
[using SWF;]
int i = 20;
txtBox1.Text = i.ToString();
txtBox2.Text = i.ToString("x");
Greets,
Daniel
|
|
|
|
|
Thanks... This seems like a more straight forward method
Weiye, Chen
When pursuing your dreams, don't forget to enjoy your life...
|
|
|
|
|
How do I emulate a union structure in C#?
|
|
|
|
|
Anonymous wrote:
How do I emulate a union structure in C#?
Note the attributes StructLayout and FieldOffset .
[StructLayout(LayoutKind.Explicit)]
public struct SampleUnion
{
[FieldOffset(0)] public bool Flag1;
[FieldOffset(1)] public bool Flag2;
[FieldOffset(2)] public bool Flag3;
[FieldOffset(3)] public bool Flag4;
[FieldOffset(0)] public long Composite;
}
-Nick Parker
|
|
|
|
|
Thanks. So for the BE_CONFIG union in the LAME api I should just start every inner struct at FieldOffset(0)?
|
|
|
|
|
Shouldn't the Composite member be of type Int32 (int )? Long s in C# are aliases to Int64 s.
[edit] I guess you could use a long if you'd like because this is a union (also only a sample ).Just the first four bytes of the long will be used when dealing with the booleans.
Also remember that these unions in C# are not CLS compliant. [/edit]
-Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
Nathan Blomquist wrote:
Shouldn't the Composite member be of type Int32 (int)? Longs in C# are aliases to Int64s.
I suppose it would be a "best programming practice", however because in C# a long maps to System.Int64 I am o.k.
-Nick Parker
|
|
|
|
|
Yeah what exactly does cls compliant really mean? Is that the same as a Microsoft Certified Professional?
|
|
|
|
|
grv575 wrote:
what exactly does cls compliant really mean?
It means that the publicly exposed interface for the member/type/assembly follows the Common Language Specification (CLS).
Some things that aren't CLS Complaint: Unsigned integer types (C#), varying public items by changing just the case of the name (like public int Foo and public int foo ).
James
"I despise the city and much prefer being where a traffic jam means a line-up at McDonald's"
Me when telling a friend why I wouldn't want to live with him
|
|
|
|
|
I'm looking for class or even just tips on how to get this done. I want to convert targa image files to either .jpg or .gif (generally something that will display properly on website). I'm not overly advanced in using C# but if given good enough pointers I could probably pick it up, though finished class would be better, I learn best from examples too
|
|
|
|
|
Following a selection I am generating a report in pdf format saving it to the server and then displaying it to the user using the folling code that runs at the end of the btnClick event.
scriptstring= "mywindow = window.open('" + rPath + "','" + sWindow + "','height=350,width=532,toolbars=no,resizable=no')" + "<" + "/script>";
RegisterStartupScript("Startup", scriptstring);
The problem is that the report is displaying under the page rather than on top of it. How can I accomplish this?
Thanks
|
|
|
|
|
Does any one know if it is possible to add a form to a panel? Thanks
|
|
|
|
|
I don't think so...
You should use a UserControl...
HTH
Shaun
|
|
|
|
|
I have an mdi application where the parent window is split in two horizontally. So I have a left side and a right side and the left side is part of the parent window. The left side contains navigation which determines which window will be displayed on the right hand side. But I want the max size of the children window to be no bigger than the area on the right hand side. Right now the children window overlaps the left hand side.
|
|
|
|
|
zuhx wrote:
Does any one know if it is possible to add a form to a panel?
Yes, it is possible, but not really recommended unless you change the FormBorderStyle.
MyForm form = new MyForm();
form.TopLevel = false;
form.Location = new Point(5, 5);
this.Controls.Add(form);
form.Show(); The only two things you HAVE to do is set TopLevel to false, and call Show . Don't forget that if the user clicks the close button on the form then the form object get's Dispose'd -- yet another reason to change the forms FormBorderStyle or at least hook the form's Closing event.
James
"I despise the city and much prefer being where a traffic jam means a line-up at McDonald's"
Me when telling a friend why I wouldn't want to live with him
|
|
|
|
|
James T. Johnson wrote:
Yes, it is possible, but not really recommended unless you change the FormBorderStyle.
I do need to change the FormBorderStyle. Can you give a little more detail on why it is not recommended? Is it only because of changing the FormBorderStyle or are there other reasons as well?
|
|
|
|
|
zuhx wrote:
Can you give a little more detail on why it is not recommended?
I don't recommend adding a form to a panel UNLESS you change the border style. Otherwise you wind up with a form that can be moved around (not so bad if that is the intended purpose) but it can also be closed which can be a problem.
James
"I despise the city and much prefer being where a traffic jam means a line-up at McDonald's"
Me when telling a friend why I wouldn't want to live with him
|
|
|
|
|
I am writing a compiler using C# and the System.Reflection.Emit classes. The problem I am having is that I go through and create my classes for my language using TypeBuilder but I can't use those classes until I call CreateType. This wouldn't be a problem except that I potentially have to define instances of the class within the class (and therefore before I call CreateType). An example of this would be a linked list node that contains an instance of itself as the next node.
So the real question is if there is some way to get the System.Type of a TypeBuilder before calling CreateType. Or alternately, is there some way to add functions and variables to an already created type that I still have the TypeBuilder for but have called CreateType? I need this because many things need a System.Type and I need to allow users to use the classes they create while programming.
Thanks
|
|
|
|
|
I feel your pain. I abandoned IL , and went with codedom. , but I believe inheritance will solve your problem here.
<a TITLE="See my user info" href=http:
|
|
|
|
|
Hmm, TypeBuilder itself is derrived from Type, perhaps that's what you need.
I also see the following remark in the documentation for TypeBuilder:
To retrieve a Type object for an incomplete type, use ModuleBuilder.GetType with a string representing the type name, such as "MyType" or "MyType[]".
Burt Harris
|
|
|
|
|
How do I find out if the system is hiding shortcut keys?
So I know how to draw the text on the button control.
If there is some simple way that I have overlooked let me
know.
Thanks You
Bo Hunter
|
|
|
|