|
Math.Round allows you to specify how many decimals to round to.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
That's correct.
But Math.Round uses the bankers algorithm for rounding. So 3.45 returns 3.4 instead of 3.5.
Be wary of that. If you need to have normal rounding (I mean the one we learn in school) then you'll need to implement your own custom rounding procedure. Which is fairly easy.
Furthermore it's wise that you choose for the Decimal type instead of Single or Double type because these types are approximations and would give rounding errors quite quickly.
Kind regards
Marcel van den Hof
|
|
|
|
|
how do i add shadows to the toolstrip menu
or a button or anything,is there any examples
any where i can look at , im using C# express
please help i have no clue and cant find anything on the subject.
|
|
|
|
|
Hi,
I'm building a very simple mail program, the only required feature is to send mail in html format. That's what i need:
1) A component like a RichTextBox that allows me to edit html files/code in a WYSIWYG way
2) Is there any component that can send a html email with pictures?
Thank u very much,
Dirso
|
|
|
|
|
|
Both has everything i need
Thank u very much,
Dirso
|
|
|
|
|
How do I set the Position of the caret of a Node in a Treeview that's being edited? There isn't a Select() function available like it is with textboxes
|
|
|
|
|
There is nothing in the .NET BCL that will do this. There is no method to call anywhere in the TreeView or TreeViewNode, it's just not supported. I don't even know if the underlying TreeView control that the TreeView class wraps supports it.
You might be able to "fudge it" by getting the handle to the control that holds the text being edited and using the Win32 API SendMessage function call to send it the appropriate messages to position the caret. Don't ask me for details, I can't give them to you. This is all just a theory...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
ok, it isn't that necassary.
Thanks anyway.
|
|
|
|
|
Darn. It seems that the Node Text can't be changed even after that text has been edited. At least it doesn't work when I do this in the AfterLabelEdit-Event because the new Node text gets assigned after this even or something like that
|
|
|
|
|
Does WindowsPrincipal or WindowsIdentity behave differently depending on whether the code is running in an Active Directory environment or a non-Active Directory environment? e.g. is a WindowsPrincipal always a WindowsPrincipal in any Windows environment?
Michael Hodnick
www.kindohm.com
|
|
|
|
|
I have a window application. I save the form setting to a xml file. everytime if i changed form setting i need to modify the node and save it back to the xml file. all the examples i seen are add node to xml. but what i needed is to change inner text of that node not add one more node append to the end of xml.
How can i do to get what i want?
Tahnks for any suggestion
|
|
|
|
|
Use SelectSingleNode with an XPath to find the node, then set it's value.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hi
I'm trying to add tabs so that each one has a name like this:
tabPage 1
tabPage 2
etc
but if many tabs are opened and closed I don't want the number to go high.
This is what I've got so far:
int i = 0;
string index = "tabPage" + Convert.ToString(i);
if (mainTabs.TabPages.Contains(mainTabs.TabPages[index]))
{
string index2 = "tabPage" + Convert.ToString(i + 1);
mainTabs.TabPages.Add(index2);
}
Thanks for your help
|
|
|
|
|
So i take it you're adding and removing tabs from the tab control, and you want to reuse numbers that have been removed up until the point of adding a new one? Is this correct? If so, couldn't you do something really simple, like create a collection (I.E. arraylist or something a little less intensive), and add numbers to it as they become available. Then remove them when you reuse them. So, you would just have a removetabpage function that would store the number of the tabpage you're removing, say 55, in an arraylist. When you created a new page, you could simply get the first number in the "discarded number" arraylist, assuming there is one, and remove it from the "discarded number" list. I'm sure someone else will have some answer thats a little more efficient, but I think this would work as a simple solution.
|
|
|
|
|
Hi All,
I need to know how can I make a list contorl like of windows explorer. From windows explorer view I mean when we open My Computer a list view is shown and the headers are shown as follows
Files stored on This computer
-----------------------------
(shared documents) (dotnetdocuments)
Hard Disk drives
------------------------------
(C),(D),..........
how can I bring this (Files stored on This computer) or
(Hard disk drives) like title in my List view
regards
|
|
|
|
|
Hi All,
Question regarding splitting a string:
Let's say I have the following format:
[a-zA-Z]*-[0-9][0-9][0-9]-[A-Z][A-Z][0-9][0-9][A-Z]
or in short form, the split would be:
<s1>-<s2>-<s3><s4><s5>
E.g,
ABC-2-725-XY15A
s1 = ABC-2
s2 = 725
s3 = XY
s4 = 15
s5 = A
Note about s1,
it starts with an alpha character and is followed by any string...
there can be dashes and numbers, but there will never be "-[0-9][0-9][0-9]-" sequence in s1 so you'd know where s2 begins
Does anyone have an idea on how to split in such manner?
Thanks,
-Julian
|
|
|
|
|
|
|
string s = @"ABC-2-725-XY15A";<br />
Match m = Regex.Match(s, @"(.+?)-(\d\d\d)-(\w\w)(\d\d)(\w)");<br />
if (m.Success) <br />
for (int i = 1; i <= 5; i++) <br />
Console.WriteLine("s{0} = {1}", i, m.Groups[i].Value);
- Bitwise
|
|
|
|
|
Thanks,
I didn't realize one could traverse the matched expression. I tried to do it with Regex.Split.
-Julian
|
|
|
|
|
When I use the Fill method of a DataAdapter it creates the table structure in my dataset. It also brings the PrimaryKey information about that table to the dataset. My question is: is there anyway to bring the "foreign key" information about the table columns ? How can I know which columns are foreign keys and to which table they refer ?
thanks
Mauricio Ritter - Brazil
MSN: mauricioritter(atsign)hotmail.com
English is not my native language so, if you find any spelling erros in my posts, please let me know.
|
|
|
|
|
See the DataRelation class in the .NET BCL. It's pretty straight-forward and easy to make a typed DataSet by right-clicking on your project (or a folder under your project, which helps set the default namespace for your source files you add to them) and adding a new type, then choose DataSet . You can even drag and drop tables, views, and stored procedures from the server explorer to create elements (the DataSet designer is, after all, just the XML schema designer) that represent tables, while their elements represent fields. You can create primary keys and draw relationships. When you save this, it serializes using the CodeDomSerializer so that you have source code.
When you use it, instead of using DataSet ds = new DataSet(); , for example, you would use MyDataSet ds = new MyDataSet(); . That already has typed table and fiend names, as well as relationships established. Note, however, that the DataAdapter derivatives - or rather the command builders like SqlCommandBuilder - don't support auto-generation of complex statements required for updating a data source with changes.
All this is programmatic changes you can do manually, as well. It's most important to read the documentation, but you might also makes a typed DataSet in this manner and examine the source code (click "Project->Show Hidden Files" in the menu to see the source file itself).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
|
great...this is exactly what i wanted...how can u encode the captured video? e.g. i have the DivX codec installed on my computer. i want to encode the video into divx on the fly..is this possible..
|
|
|
|