|
very true, but it didn't help...
|
|
|
|
|
Friends,
How can i successfully compile a low level code in C#.
Thanks in advance.
Sheel Gohe
|
|
|
|
|
If I write a DLL assembly in C# using .NET, can I use it in my VC++ / MFC projects? My question is can such C# DLL be used in C++ type projects WITHOUT first converting the DLL in a COM ?
Thanks
|
|
|
|
|
Just set your C# project to Register For COM Interop in Project Properties.
|
|
|
|
|
is there any way within the .net framework to determine if a string contains a numeric value?
|
|
|
|
|
The easiest way is to put a try...catch around the conversion:
try {
num = int.Parse(str);
ok = true;
} catch {
ok = false;
}
Exceptions are quite expensive, though, so it's more efficient to validate the string before you convert it. You can use the Regex class to check if the string only contains digits, for an example.
---
b { font-weight: normal; }
|
|
|
|
|
do you mean if the string is a number, or can contain a number somewhere amongst a lot of other characters?
For the first, if you want to figure out if a string is a number, I'd use Double.TryParse(string) to figure this out (returns a boolean). (Much more effective then "try-catch"ing)
For the latter, I'd use regular expression to match any digits (\d) and then it'll return boolean. (regular expression can also subtract the numbers it finds, if needs be...)
I hope this help.
---------------------------
127.0.0.1 - Sweet 127.0.0.1
-- modified at 3:18 Monday 5th September, 2005
|
|
|
|
|
|
i have windows service program,and i want to make a config file for it.
if the config file is placed in the directory:system32/,i can access it by System.Environment.SystemDirectory,but when placed in the windows service executable files' directory(bin\debug\),i don't know how to access it.
|
|
|
|
|
You don't need to access the file directly.
Use the classes in the system.configuration namespace to access the configuration file.
If you just have simple string data to access then you can use the AppSettings class and section.
Otherwise you can write your own section handler.
The file should be named yourexe.exe.config, but vs.net will copy any file named app.config from the root of your project to the output directory and rename it to the proper name so your service will read it.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
|
Anyone knows how to disable the tab key function in window form (which move the focus to the next control in the form)? I want my rich text box processes the tab key press like any other key.
Thanks for the answers
|
|
|
|
|
See the AcceptsRab property[^].
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
Just Set RichTextBos's "AcceptsTab" property to "True".
Happy Coding.
Sheel Gohe
|
|
|
|
|
haha, code a lot and forget so simple thing
|
|
|
|
|
Thanks guys!
|
|
|
|
|
I'm building a usercontrol that has multiple buttons on it, and i need to set one of them as the accept button, but i can't find anything about how to do this.
From what i can see it is only accessable from the Forms.Form not Forms.UserControl...
Is this entirely the truth, or can I still somehow set this to work so it validates against my "Ok" button, when someone hits enter.
string Beautiful = "ignorant";
label1.Text = "The world is full of " + Beautiful + " people.";
Why is common sense such an un-common comodity?
|
|
|
|
|
Your user control can't have an AcceptButton property because what happens if there are multiple user controls on the same form and all have that property set? which is the one that counts?
A workaround is to expose a public read only property named something like DefaultButton , and have it return a reference to your OK Button . Then, the form can set its AcceptButton property to that reference. Or the other way around, make the form pass a reference to itself to the user control, so it can set the form's AcceptButton property (I like the first way better).
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
Hi,
I would like to find an example of ruler control, does anyone have this experience ? I would like how to do ~, thanks !!
|
|
|
|
|
A ruler control is a pretty simple owner drawn control, I'm sure google will bring you some matches.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
thanks all of you, it should give me some hints
|
|
|
|
|
Hi :
How can I darg-drop item to a WebBrowser control ?
I created an application written by C#,it includes two forms , one form
includes a TreeView control , the other includes a WebBrower control and a
TextBox control, now we call them as Form1 and Form2.
First , I try drag a item to the TextBox control,(I have set TreeView for
drag well ) I set
"this.textBox1.AllowDrop = true;" then add Events and write these methods:
this.textBox1.DragOver += new System.Windows.Forms.DragEventHandler
(this.textBox1_DragOver);
this.textBox1.DragDrop += new System.Windows.Forms.DragEventHandler
(this.textBox1_DragDrop);
this.textBox1.DragEnter += new System.Windows.Forms.DragEventHandler
(this.textBox1_DragEnter);
Run this application,and drag item from TreeView which in Form1 to TextBox
which in Form2,the TextBox 3 Events (DragOver,DragDrop,DragEnter) is done
well.
But when I want drag item to the WebBrower,I can not find DragEnter Event and
others Events related to "Drag-Drop",so I can not drop Item to WebBrowser.
Also I have tryed set WebBrowser's Document.DesignMode="On",but can not drop
too.
Then I Write a HTMLBody's ondragenter Event ,but this ondragenter() can not
trigger.
So I think it must be solved by COM knowledge.
Can any one give my some suggestion,
because my COM knowledge is poor, if anyone give me an all solved code ,I
will be very appreciated.Thanks very
|
|
|
|
|
You can't drag and drop onto a web control. What were you hoping to drag and drop onto it ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks for your reply,well,I'm doing a HTMLEdit control writen by c#,and I want to drag a html tag item into this control,then I paste a tag html into this control.
Sorry for my poor English ,but I really want your help ,thanks
|
|
|
|