|
hi,
in c language we use \n for nextline
but what is the method of nextline in c#.
textBox1.Text = "A";
textBox1.Text += "B";
i want
A
B
not AB
I AM WORKING ON "PLOTTER ROBOT"(FYP).
|
|
|
|
|
Erhm, you can still use the \n and \r characters, but what would be better is :
<br />
Environment.NewLine<br />
|
|
|
|
|
Use the Environment.NewLine property. It gives you the proper character combination depending on the platform that the code is running on.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
but how i can use Environment.NewLine
what would be updation on following code
textBox1.Text += "A";<br />
textBox1.Text += "B";
I AM WORKING ON "PLOTTER ROBOT"(FYP).
|
|
|
|
|
textBox1.Text += Environment.NewLine;<br />
textBox1.Text += "A";
Is it right?
I AM WORKING ON "PLOTTER ROBOT"(FYP).
|
|
|
|
|
zeeShan anSari wrote: Is it right?
Did you try it? Did it work?
|
|
|
|
|
ya
I AM WORKING ON "PLOTTER ROBOT"(FYP).
|
|
|
|
|
Hello,
I have never used the printing functionality in C#.
I am having a data grid which is having 3 colums. I want to print one column out of three and some more custom data with this column. I want to print the data in tabular form with some header lines like "Name", "Date" etc.
How do i print in C#.
Thank a lot in advance.
-- modified at 5:50 Friday 19th October, 2007
|
|
|
|
|
|
Let's have a look at the datagrid print code i am writing......
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
int iHorzResolution = e.PageSettings.PrinterResolution.X;
int iVertResolution = e.PageSettings.PrinterResolution.Y;
int iPaperWidth = e.PageSettings.PaperSize.Width;
int iPaperHeight = e.PageSettings.PaperSize.Height;
int iWidthPixel = iPaperWidth * iHorzResolution/100;
int iHeightPixel = iPaperHeight * iVertResolution/100;
PaintEventArgs myPaintArgs = new PaintEventArgs(e.Graphics, new Rectangle(new Point(0, 0), new Size(iWidthPixel, iHeightPixel)));
this.InvokePaint(datgrdSerialNumber, myPaintArgs);
}
private void btnPrint_Click(object sender, EventArgs e)
{
printDocument1.Print();
}
Now if i fire the print command, i am not getting the size of of grid accroding to my page(A4). It just prints the grid in left corner. Where am i going wrong???
Thanks.
|
|
|
|
|
Hellow, ho do i can to prevent removing row from DataTable. I.e. when row are being removed
by user, i need to validate this action and only after this remove this row or cancel this if neccessary.
I can't use RowDeleteing event because this one can't prevent row deletion if needed, such as only way to do this (as i know) is throw an exception and catch one by myself. But in my code i can't controle exception what throw my DataTable.
Thank.
|
|
|
|
|
Extend base datatable creating a new event on datarow remove
Visit my blog at http://dotnetforeveryone.blogspot.com
|
|
|
|
|
Could someone please help me with this loop I'm working on.
The goal is to end up with a list of rar-files to be deleted after unpacking.
I have a list of the first rar-files in the span and I want to get the rest.
For the new-style rar-files, I figured I remove the ".rar" and ".part" from the filename
and just add one number higher, but that doesn't work since there are zeros to account for.
For the old-style rar-files I'm even more lost since there are booth zeros and letters added.
I know the letters are added one higher but I can't figure out a good way to do it.
This is what I've got now:
"rarsToDelete" contains the first rar-files in span
"rarSpanList" should contain the rest of the files in the end
private void DeleteRarFiles()<br />
{<br />
if(rarsToDelete != null)<br />
{<br />
ArrayList rarSpanList = new ArrayList();<br />
foreach (string s in rarsToDelete)<br />
{<br />
string fileNoExt = s.ToLower().Substring(0, s.LastIndexOf(".")-1);<br />
if(fileNoExt.EndsWith(".part1"))<br />
{<br />
string fileNoExtNoPart = fileNoExt.Substring(0, s.LastIndexOf(".") - 1);<br />
int i=2;<br />
string testFile = fileNoExtNoPart + "part" + i;<br />
while (File.Exists(fileNoExtNoPart + "part" + i))<br />
{<br />
rarSpanList.Add(testFile);<br />
i++;<br />
}<br />
<br />
}<br />
else if(File.Exists(fileNoExt+".r00"))<br />
{<br />
<br />
}<br />
}<br />
}<br />
}
Thanks
|
|
|
|
|
Look at the System.IO.Path class, it will save you alot of the grieve you are attempting now
xacc.ide
The rule of three: "The first time you notice something that might repeat, don't generalize it. The second time the situation occurs, develop in a similar fashion -- possibly even copy/paste -- but don't generalize yet. On the third time, look to generalize the approach."
|
|
|
|
|
|
obj.dog() is private, you cannot call it. the compiler throw an error.
if you make it public, then you can call it.
private : can only be called inside that class.
public : can also be called outside that class.
|
|
|
|
|
If u r writing this code in C# then u must have to specify the return type for the function
and this code can't run
bcz u can't access the private variables
even the intellisense will not show u the private members
|
|
|
|
|
Trustapple wrote: can anybody help me to understand private ,public functions and keywords and how they affect inheritance.....i tried a couple of codes whre i made base class method private and tried to call them and its calling just like a public method....so i think i am missing something.
for example
class animal
{
private dog()
{
}
}
class bird
{
private sparrow()
}
}
class mainclass()
{
animal obj = new animal();
obj.dog();
}
this works fine so what is the use in making the method private????
any kind of help will be appreciated
OK - 1st - get a book. Read the first few chapters, type in a few examples, then, when you get stuck post here.
Your code generates at least 10 errors on compilation. Did you try it out?
class animal
{
private void dog()
{
}
} As somebody else said - methods need a return type.
class bird
{
private sparrow()
}
} No return type, no closing brace, not even used in Main - let's forget about this for now.
class mainclass()
{
animal obj = new animal();
obj.dog();
} I haven't a clue what this is about...class mainclass() ? I assume you meant
static void Main(string[] args)
{
animal obj = new animal();
obj.dog();
}
Which, if you attempt to compile gives
Error 1 'TestApp.Program.animal.dog()' is inaccessible due to
its protection level
So, private does what it says it does - it is private. NObody can see it, except from within the Animal class.
Trustapple wrote: this works fine
It doesn't really does it?
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
|
|
|
|
|
Trustapple, I'll re-itterate my advice from umpteen times in the last week. You will learn ALL of this stuff much much better if you go and find yourself a biginner book on programming. There is no shame in doing so - we all had to start somewhere.
|
|
|
|
|
And please stop deleting your messages! You have been asked politely before. We are NOT mocking you we are trying to HELP you!
|
|
|
|
|
I thought he might, so I copied the whole message in my reply. I doubt I will reply to any more of his posts if he won't play ball.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
|
|
|
|
|
Can anyone help me please making this program, i use vceexpress (visualc++2005),
the program must be written in c#
i must open an html file and i must see the text in it, not the hole html file.
thx
kuscu
kuscu
|
|
|
|
|
Try
String[] arrayOfHtmlLines = System.IO.File.ReadAllLines("myHtmlFile.html");
This will give you an array of lines.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
|
|
|
|
|
hallo, thx for the answer, but i just began to program, and need a full program, i'm trying to solve with the answers here but it won't work, so can you help me with a hole program,
i'm yusing vcExpress2005
thx
|
|
|
|
|
I will happily help you - it is what we do here. You post the code you have tried and I or somebody else will tell you what is wrong with it. We will not write a whole program for you unless you pay us.
|
|
|
|