|
J4amieC wrote:
Its called a Ternary operator I think. But don;t quote me on that!
That is correct. It's called a conditional or a ternary operator.
And you can quote me on that.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks Guffa, had a brain fart moment and couldnt think whether id made the name up or not...
|
|
|
|
|
Hi all,
I have posted a similar question before... I asked how i could trim a way the last character if it is a ",". And i got loads of ways, thanks.
Now i want to know how to trim away more than one character.
would it work, if i use one of the examples someone gave me, to do it like this...
strName[strName.Length-1] = string.Empty;
But if i make the "Length-1" part where the "-1" is the number of character i want to trim, would this be correct?
Thank you in advance
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
Simplest solution I can think of is using SubString method:
strName.SubString(0, strName.Length - 4);
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
thank you...
i used that example to get rid of one caracter aswell.
so am i understanding this right if i say that the "-4" or "-1" would be the amount of caracter to be left out from the end?
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
NarutoFan#1 wrote: so am i understanding this right if i say that the "-4" or "-1" would be the amount of caracter to be left out from the end?
In case the first parameter (startIndex) equals 0, that's true.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Okay, Great.
Thank you...
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
NarutoFan#1 wrote: would it work, if i use one of the examples someone gave me, to do it like this...
strName[strName.Length-1] = string.Empty;
Who gave you that example? That is not even close to something that would work.
The indexer property of a string returns a character, so the value of strName[strName.Length-1] is a character value. The property is read only (as strings can not be changed), so you can not give the character a new value. Even if you could, you would not be able to change the length of the string, and you would not be able to put in a string in place of the character.
As you can not change a string, the only way to get a string with a different contents is to create a new string that contains what you want. The SubString method (as suggested by Stefan) does this. The Remove method can also be used:
strName = strName.Remove(strName.Lenght - 4, 4);
---
b { font-weight: normal; }
|
|
|
|
|
|
I see.
As lmoelleb already pointed out at the time, the code is utter nonsense.
The only scenario where this code might be the useful is if you deliberately want to produce a compiler error. Even then it's hardly the best code, as the same result can be obtained with much simpler code, e.g.:
char c = "";
---
b { font-weight: normal; }
|
|
|
|
|
LOL
So i won't even think of using that piece of code....
Thank yo for your help.
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
I see you are the one who gave me this example, and this is the one i used...
so i suppose no harm done......
strNum = strNum.SubString(0, strNum.Length - 1);
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
hi all,
how can i create checkboxes dynamically in a C#.net2005 WEindows application..
Thanks in advance..
|
|
|
|
|
Create a CheckBox control and add it to the form.
---
b { font-weight: normal; }
|
|
|
|
|
<br />
<br />
CheckBox myBox = new CheckBox();<br />
<br />
myBox.Checked = true;<br />
<br />
myPanel.Controls.Add( myCheckBox );<br />
<br />
Regards
Malc
*********************************************
|
|
|
|
|
The example you were given is sort of right, but if you want to see the checkbox whre you want it, you need to set the Left, Top, Width and Height properties as well.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi all,
I am working on DXF formats in c#.NET in windows applications.i was struck with reading data from dxf formats i.e.,importing data.how to import the data according to the requirement of the values....Plz help me ASAP.
advance in thanks,
cnr.
|
|
|
|
|
1. Search the net for a specification of the dxf format to learn how data are organized.
2. Choose an appropriate reader (binary, text, xml, ..) according to the way data are stored in dxf format.
3. Finally read the data with the chosen reader in a way the dxf format specification implies.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi
i want to make a application just like setup wizard.
form are should be appear by a next click in a main form one by one .
but next button shold be static for all form
how can i do that
Plz tell me simple solution
Parshant
|
|
|
|
|
Hello
Instead of making a form for each step; make a single form for your wizard. Now in the design mode, make each page's controls -textboxes, comboboxes, listboxes, etc..- in a container such as Panel , or a GroupBox . Put all Panels on top of each other -It will be a bit of a miss in the design mode I know -, and hide them all except the first page. Under the panels make you next/back buttons to hide/show pages asd requested by the user.
Regards
|
|
|
|
|
RichEditCtrl
Is it possible to create a richeditcontrol with ruler on top and row number on left side using Visual Studio .Net 2005 C# with the following features?
1.RichEditCtrl should allow bytewise cursor movement ( not characterwise)
2.Inside the control, horizontal and vertical lines need to be drawn along with the other language text.
Shanthi.M
|
|
|
|
|
shan2k wrote: Is it possible to create a richeditcontrol with ruler on top and row number on left side using Visual Studio .Net 2005 C# with the following features?
Impossible is nothing
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi All,
I use this code to set value for store procedure parameter. Then it is OK.
report.Load(@"..\..\Reports\CrystalReport2.rpt");
report.SetParameterValue(0, "test");
crystalReportViewer1.ReportSource = report;
But when I use SetConnection for this report then the parameter can't get value which I set.
report.Load(@"..\..\Reports\CrystalReport2.rpt");
report.SetParameterValue(0, "test");
foreach (CrystalDecisions.Shared.IConnectionInfo connection in report.DataSourceConnections)
{
connection.SetConnection(serverName1, database, userID, password);
}
crystalReportViewer1.ReportSource = report;
Could any one help me what wrong of this code.
|
|
|
|
|
Hi Every body,
This is prasad. i want some information about webservies.i want to know how to call the webservies . i did the webservices in my local system but i don't know how to call the weather & Time webservies form their providers. So ,Please can any bosy hepl me regarding in this concept .
Thanks & Regards,
T.GuruPrasad Reddy.
|
|
|
|
|
You add a reference to your webservice in the IDE, which creates classes that handle connecting to the service, you call the classes as if they were local to you, there's no additional work required.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|