|
My report size is A3. When I export to .rtf or .doc it can't display correct. Can I set paper size before export?
Code:
...
ExportOptions crExportOptions = crReportDocument.ExportOptions;
crExportOptions.ExportFormatType = ExportFormatType.RichText;
crReportDocument.Export();
QuynhTD
-- modified at 23:31 Monday 21st May, 2007
|
|
|
|
|
You just have to right click on report format --> Design --> Page Setup --> Page option --> Select The format of your choice.
|
|
|
|
|
Hello everyone,
I have a DataGridView which I am populating it with a data from a remote database. One of the columns in the DataGridView is holding images. I would like to know if it is possible to display the image in the DataGridView in a ImageBox using the index of the row?
Thank you very much and have a great day.
Khoramdin
|
|
|
|
|
You can add ImageColumn to a datagridview.
google for "DataGridView ImageColumn".
|
|
|
|
|
I am trying to make a program in C# that will find the average of all prime numbers 1 to 100 and print the output to the screen. I am very lost in this, as I am new to the whole programming world. I have been unable to come up with any code that works so any help with this would be greatly appreciated. Thanks!
here is what I have so far:
The general layout of the code will possibly look like:
assign a var for isPrime as bool (which is used as a flag that will be changed if the program does a calc that has no remainder. )
assign a var that keeps track of number of primes it gets
ex double totalPrimes
assign a var that adds up the number when decides if prime of not
ex double runningTotal
assign number you will check
assign number you will use to divide by
then
while (numberToCheck <=100)
{
-set isPrime to true again(always start with it as true)
-set the divideBy var back to value 2
while (divideBy < numberToCheck)
{
-then you do if statement to check if the calc has remainder or not
-and if it doesn't then change isPrime false (since no remainder means it is not prime)
-then increment divideBy number and try the next number
-if after all calculations are done and isPrime is still true, then the nubmer is prime
-then provide an if statement to check if number is prime or not
if so then add the number to the runningTotal and chalk up another for the total of primes,
-if not prime then increment that number and run through the first loop
-- modified at 21:08 Monday 21st May, 2007
|
|
|
|
|
OK, sounds like a first homework assignment to me. How do you define a prime number ? How does that definition help you to work out if a number is a prime number ? Once you know it's a prime, what do you need to do with it, if you want to calculate an average ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Sorry but "Lurker" usually means "Home work poster" here
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Dear all,
The following code returns an error :
ToolStripMenuItem mv = new ToolStripMenuItem(w.Name, new System.EventHandler(OnChange));
Error :
The best overloaded method match 'System.Windows.Forms.ToolStripMenuItem.ToolStripMenuItem(string, System.Drawing.Image)' has some invalid arguments.
While the following code compiles just fine :
ToolStripMenuItem mv = new ToolStripMenuItem(w.Name);
What am I doing wrong ?
Cheers,
|
|
|
|
|
Dear all,
After some fiddling I found the following workaround :
Image image = null;<br />
ToolStripMenuItem mv = new ToolStripMenuItem(w.Name,image, new System.EventHandler(OnChange));
This did the trick. If there is anyone with a better solutions, please let me know.
Cheers
|
|
|
|
|
The way you are doing it now is not a bad way to do it. The problem you had before has to do with the parameters you were passing. It was looking for a string and an image and you were passing a string and a delegate.
The only thing that I would change is don't make an image object for no reason, just set it to null:
ToolStripMenuItem mv = new ToolStripMenuItem(w.Name, null, new System.EventHandler(OnChange));
That will save a little time and memory.
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
|
|
|
|
|
Thank you for your reply.
You are absolutely right though. What you've shown me is a much better way of doing. Basically we're doing the same thing, however your way is more elegant.
Thank you so much again !
|
|
|
|
|
hi
i want to use regular expression to ignore some characters in string that i want to search within it, but i don't found good tutorial for this topic(regular expression).
can anyone guide me for it and special characters for regular expressions like $,*,\\d, .... ?
thanks
|
|
|
|
|
|
I keep this[^] page bookmarked for these types of questions
|
|
|
|
|
hello,
i have 5 checkboxes in the form, i want to do something like this:
<br />
foreach (control c in this.Cotrols)<br />
{<br />
if (c.GetType.ToString() == "System.Forms.CheckBox")<br />
{<br />
MessageBox.Show("anything"); <br />
}<br />
}<br />
the problem is:
if the checkboxes are inside a panel, ou a groupbox, i cant verify if exists checkboxes in the form...
what i can do to find the checboxes that are inside de panel/groupbox?
thanks a lot
|
|
|
|
|
Controls can have child controls of their own. If you know the checkboxes are in a group or on a panel, all you have to do is look in the Controls collection of that container control.
Also, don't EVER convert the type name to a string and compare it to what you think the full type name should be. You'll just end up writing code where you can't fathom what wrong with it.
foreach (control c in Panel1.Controls)
if (c is CheckBox)
...
|
|
|
|
|
foreach (control c in Panel.Cotrols)
{
if (c.GetType.ToString() == "System.Forms.CheckBox")
{
MessageBox.Show("anything");
}
}
only two letters away from being an asset
|
|
|
|
|
check the type of c and if it is a panel use the c.Controls to itenerate through it's children.
-- modified at 16:21 Monday 21st May, 2007
topcoderjax
|
|
|
|
|
Recurse the controls as a tree.
Call seekCheck pasing the form as first control.
private void seekCheck (Control B)
{
foreach(Control Con in B.Controls)
{
if(Con.Controls != null) //is a container
{
seekCheck (Con);
}
else
{
if(Con id CheckBox)
{
MessageBox (".....");
}
}
}
}
|
|
|
|
|
Fernando Jaspion wrote: if (c.GetType.ToString() == "System.Forms.CheckBox")
You don't want to do a string compare here. What you want is:
if (c.GetType() == typeof(System.Forms.CheckBox);
Ian
|
|
|
|
|
no no, just
if (c is CheckBox) ...
|
|
|
|
|
right you are!
Ian
|
|
|
|
|
Hello,
I mostely prefere to cast direct to the class I'm checking on, cause often a member of this class is on interest.
CheckBox cb = c as CheckBox;
if(cb!=null)
A recursive method would check the "Controls" property of the Control instance c.
RecursiveMethod(this.Controls);
private void RecursiveMethod(ControlsCollection cc)
{
if(cc!=null)
{
foreach(Control c in cc)
{
CheckBox cb = c as CheckBox;
if(cb!=null)
{
}
else
{
RecursiveMethod(c.Controls);
}
}
}
}
Hope it helps!
All the best,
Martin
|
|
|
|
|
I want to use other name of class for example:
this is a simple class:
class Myclass
{
private int _No;
public Myclass()
{
}
public int No
{
get{return _No;}
}
}
I want to use other name a new name (Nocc) for Myclass
Nocc N1=new Nocc();
N1.No=91;
|
|
|
|
|
Your Myclass doesn't have another name. Where did this Nocc thing come from?
|
|
|
|