|
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.
|
|
|
|
|
Perhaps this article would help you:
HTML Parser[^]
Virtual1ty "Any fool can learn from his own mistakes, but a wise man learns from mistakes of others"
|
|
|
|
|
kuscu wrote: i must open an html file and i must see the text in it, not the hole html file.
Do you mean the content of <body></body> tags ? Then you can
1 - Open HTML page and store the text in a variable
2 - Find index of <body> and </body> tags inside it.
3 - Use substring to get the values in between these tags
OR
4 - Use a regular expression to find the text in between these tags
|
|
|
|
|
hi does anyone know how to export a ssrs report programmatically into rtf / word,/ xml /csv formats?
|
|
|
|
|
You asked this yesterday - what have you tried to do between now and then to get it to work? Post a code snippet - people here love going through code and if you've made an effort, then they will also make an effort to help.
I am not saying you haven't made an effort before I get shot down in flames, but this question is too general.
"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."
|
|
|
|
|
Hi guys.
I'm building a windows service that uses an ActiveX object.
When I try to instantiate the ActiveX I get this error.
Could not instantiate ActiveX control 'XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX' because the current thread is not in a single-threaded apartment.
I've changed the thread apartment style in the service, instantiated the ActiveX in a separate STA thread and still get the error.
Have any of you been in a similar situation ? if so, have you found a solution ?
Thanks in advance
Free your mind...
|
|
|
|