|
Hello
Did you revise the printing section in C# articles page?
Regards
|
|
|
|
|
hi,
I tried searching in the articles but i am not lucky to find anything.
If you can please point me to an article that may benefit me.
thanks
jamil abou khalil
|
|
|
|
|
I'm developing an Outlook Add-in with Visual Studio 2005 using COM.
I created a new project via Extensibility -> shared add-in, and I need to add the reference "Microsoft.Office.Interop.Outlook" in order to go on with the development. But it is no where to be found in the "Add Reference" Dialog Box.
Somebody help me, please......
|
|
|
|
|
I solved it myself...
The assembly is right there in:
COM -> Microsoft Outlook 11.0 Object Library......
|
|
|
|
|
I am creating a custom draw treeview with level 0 treenodes draw by the code below. I want to paint the entire node row, including behind the PlusMinus button with a color of choice.
The problem happens with my code running after the PlusMinus button is painted,thus erasing it. Is there some event fired before OnDrawNode painting the "+" that i am missing and should override?
Setting a breakpoint on the begining of OnDrawNode and seeing the control, shows me the "+" is already painted.
protected override void OnDrawNode(DrawTreeNodeEventArgs e){
if (e.Node.Level == 0){
Rectangle nodeRegion = new Rectangle(ClientRectangle.X, e.Node.Bounds.Y, ClientRectangle.Width, e.Node.Bounds.Height);
SolidBrush nodeBackColor = new SolidBrush(Color.BlanchedAlmond);
SolidBrush nodeForeColor = new SolidBrush(Color.Black);
Font nodeFont = (e.Node.NodeFont == null) ? this.Font : e.Node.NodeFont;
e.Graphics.FillRectangle(nodeBackColor, nodeRegion); // PROBLEM
e.Graphics.DrawString(e.Node.Text.Trim(), nodeFont, nodeForeColor, e.Node.Bounds.Location);
}
else{
e.DrawDefault = true;
}
base.OnDrawNode(e);
}
ps.: It looks like the OnPaint event isnt fired on a TreeView. Couldnt find why is this on MSDN.
Thanks!
Diego Valdevino
|
|
|
|
|
I have a UserControl and when Iam not using this.Region to form a custom shape for my UserControl everything is ok except that in the upper left and right corner you can see a cotrol background.
See here: http://img87.imageshack.us/my.php?image=goodjo2.jpg
When I put this piece of code:
region.Intersect(gp);
this.Region = region;
Where the gp looks like:
gp.AddArc(0, 0, 20, 20, 180, 90);
gp.AddArc(this.Width - 21, 0, 20, 20, 270, 90);
gp.AddLine(this.Width - 1, 20, this.Width - 1, this.Height - 1);
gp.AddLine(this.Width - 1, this.Height - 1, 0, this.Height - 1);
gp.CloseFigure();
In other words, those darker blue lines (borders) of the UC, I get this ugly looking corners in upper left and right corners and no right and bottom line.
See here: http://img291.imageshack.us/my.php?image=badid4.jpg
My question is, how can I set an Region to my UC without this 'stuff' around upper left and right corners and with right and bottom lines?
I hope you understand.
|
|
|
|
|
|
Hello,
I'm using Application.Exit(); in the form contructor to terminate the application if certain condition is met... but it's not working!
Why? and what can I do?
Thanks...
|
|
|
|
|
Hello
I believe you are making the famous scenario of checking a condition -maybe login or something- at the start of your application, if(false) => Exit(). Right?
Well if you take a look ate Program.cs file where the main method exists, you'd see this line
Application.Run(new MyForm());
So actually it excutes more like this:
MyForm temp = new MyForm()
Application.Run(temp)
Well, not exactly but I made it this way to illustrate that your constructor must return first before the Run() method actually gets called, and of course calling the Exit() method is useless if the Run() didn't get excuted first.
Suggested solution:
Simple; Make the Application.Exit() call in your Form_Load event if applicable.
Regards
|
|
|
|
|
|
Bad answer -- you can't Application.Exit() in Form_Load either. Only solution is change of architecture: don't start the form if you don't want to display it
|
|
|
|
|
Hello .
I am looking for a program or
an idea how to parse C# files .
What I mainly need to find is disposing of created objects in the methods
In each method in each class that is in the file ,
I want to look for object creation statement :
myObject = new CMyObject()
And then to see whether this object is disposed in the end of the method
( in the finally ) .
And I also want to analyze more stuff .
The question is whether anyone knows a program that can help me ,
or can give me an idea how to do it ?
CodeDom can help me ?
Is it possible to create CodeDom objects hierarhy from source code ?
Thanks
|
|
|
|
|
Hello
Well, regular expressions is pretty much what you are looking for. Use it to identify the pattern of creation, then extract the object's name from it. Using that name you can search for disposal code if exists. Since I'm not that good in Regex, I wouldn't be much helpful in phrasing your Regex, but if you don't know Regex:
The namespace you'd use : System.Text.RegularExpressions
A very good tutorial site: This site[^]
VoidPointer wrote: CodeDom can help me ?
CodeDom would be a choice if you want to modify the code and compile it through your program. But if you just want to search and modify something in the cs files -which could be much treated as text files-, then you wouldn't need CodeDom.
Ps. You application sounds pretty much as a Visual Studio Add-in!! Is that what you're trying to make?
Regards
|
|
|
|
|
Thanks .
Let's see whether others have some ideas too .
I mainly need this for my personal use .
( I have a huge project and we add modules all the time to it
and checking this manually is not much fun )
Though maybe I'll convert this functionality ( when and if I'll write it )
into an add-in for VS .
|
|
|
|
|
i have two Forms : Form1 and Form2
from Form1 i show Form2:
Form2 form2 = new Form2();
form2.Show();
i want from Form2 to Close Form1 by using the same code:
Form1 form1 = new Form1();
form2.Show();
but doesn't close Form1
|
|
|
|
|
Hello
I don't know why someone flamed you with score 1.0, and didn't even answer you -wasn't me btw-. Your question is quite very simple -forgive me for saying that-. I guess you didn't do much reading in OOP did you?;)
The first block of code is fine in creating a form, while the second is far from closing one:
m.m._2007 wrote: Form1 form1 = new Form1();
The above line creates a new form of type Form1. So refereing to it would be to the new form not your original form.
m.m._2007 wrote: form2.Show();
And this line shows the new form that you've just made in the previous block. Why on earth did you expect it to close the original one? Shouldn't you've called the method Close() at least?
To make your code work you have to pass reference to your original form to the Form2 object and call the Close() method for it.
Edit your Form2 constructor to
private Form1 orgigenal
Form2(Form1 or)
{
origenal = or;
}
Now show Form2 like this:
Form2 myForm = new Form2(this);
and in Form2 close Form1 like this
origenal.Close();
I hope you got it, and I strongly suggest you do more reading in C# OOP programming.
-- modified at 21:59 Tuesday 24th October, 2006
Regards
|
|
|
|
|
form2 is builded by form1
You close form1 in form2,and the application will terminate
The code like this:
Code in Form1:
private void button1_Click(object sender, System.EventArgs e)
{
Form2 form2 = new Form2();
form2.Frm = this;
form2.Show();
}
Code in Form2:
///
/// Form which will close
///
private Form _frm = null;
public Form Frm
{
get
{
return _frm;
}
set
{
_frm = value;
}
}
private void button1_Click(object sender, System.EventArgs e)
{
Frm.Close();
}
phenix-burn
|
|
|
|
|
How exactly does this method work?
It seems to me that it's supposed to check the Socket object state for the number of specified miliseconds and if during this period it will determine that the Socket is in state given in the method, it will return true or false if it's not and if the time elapses and the state won't match the definition given in the method it will return false. Is this correct? Does poll method block the socket?
Next questions concerns the POP3 service. I'm trying to connect to the service and authenticate user. My program always return exception when it is trying to connect to pop3 server for the first time after boot up. I used the polling to determine if the socket state is "read" (after connecting to service) with 20 second timeout. If it is then the the Receive method of the socket is called if it's not the exception is returned. I always get the exception when I try to connect after boot up.
What may be the reason of this? How would You get around it?
Thanks in advance.
p.s.: The socket is in blocking mode.
|
|
|
|
|
I need to compute the number of months between two dates (DateTime objects). Does anyone know a way to do this? I know I can count the days between the dates by subtracting one from the other to get a TimeSpan value and grab its Days value, but how about the number of months in between the dates?
|
|
|
|
|
That depends on how you define the difference in monhts.
You can calculate a linear month index by taking the year times twelve plus the month. Then you can compare the indices to get the difference is monhts. That of course means that the difference between 2006-10-31 and 2006-11-01 is one month.
---
b { font-weight: normal; }
|
|
|
|
|
with a control when it is double clicked? When a customized control is double clicked, it takes the right mouse button to cause the code to be executed. I checked for articles but could not find one that clearly explained why the left mouse button does not work with a customized control.
It works fine with a regular command button, but for some reason it does not work with a custom run-time control. What are the requirements for connecting event handlers so that the left mouse button will properly invoke the click and double click event handlers? Why is the right mouse button even involved when a customized run-time control is a either clicked or double clicked?
I would appreciate some assistance. I am certain that there are others that would like to know the reason and how to correct it.
-- modified at 18:31 Tuesday 24th October, 2006
|
|
|
|
|
Anybody know how to get a CollectionEditor derived class to properly edit a List<t> collection? What I have is an abstract base class that is passed to a List<> collection, like so:
public List<BaseThing> Things
{
...
}
I've got several classes that derive from BaseThing, and they're presented to the CollectionEditor via the CreateNewItemsTypes method. I can open the editor, but as soon as I click the 'Add' button, I get the following error:
The value 'DerivedThing' is not of type 'BaseThing' and connot be used in this generic collection.
This seems like a limitation of the editor, or in how I'm implementing something, because in my NUnit test cases, one of my tests is to create this List<basething>, and add several derived items to it, and it works.
Any ideas? Thanks in advance.
Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan
Portland, Oregon, USA
|
|
|
|
|
Hi,
I am trying to use the settings.designer.cs file for a value that needs to be put into the app.config file.
My config(auto-generated by VS2005) file now looks like this:
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="Settings1" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</sectionGroup>
</configSections>
<applicationSettings>
<General.Settings1>
<setting name="DatabasePath" serializeAs="String">
<value>C:\Web\App_Data\Messages.mdb;</value>
</setting>
</General.Settings1>
</applicationSettings>
</configuration>
From the code when i access this property i am using this code:
Settings1 set = Settings1.Default;
string str = set.DatabasePath;
return str;
The above line of code returns null... can anyone explain what am i missing here???
|
|
|
|
|
Try this:
Properties.Settings set = Properties.Settings.Default;<br />
string str = set.DatabasePath;<br />
return str;
or simply
return Properties.Settings.Default.DatabasePath;
Cheers,
Craig
** I'd rather try and fail than fail to try **
|
|
|
|
|
i know this question is dull but i need to ask it guys. If i have an array of strings lets say ( string[] array = {"1","2","4","boss","678"} ) and i need to pick one randomly without a specific string lets say "4" (the answer should not never be 4). May i know how ? Thanks for the help,
P.S: i can do it in different ways but i need it in one line of code and that, my friends , i dont know how.
Any help appreciated .... Thanks guys
|
|
|
|