|
Search this forum, this topic has been discussed lately.
mav
|
|
|
|
|
Can someone point me to where to find information, with code example in C#, on how to retrieve Names and Addresses from an Addresss Book in Public Folders of MS Exchange Server 2000.
Fred S. Parker
Email: fred@fsparker.com.au
|
|
|
|
|
|
Thank you for your prompt reply.
However, I am only interested in a solution for a Windows Form application, not Web, and using C#.
Fred S. Parker
|
|
|
|
|
The code is always the same, not matter if it is used in a VB, Web, or C# application.
You can access Exchange via CDO 1.21, WebDAV, or the Outlook COM Classes.
seaarch the Google Groups[^], you'll find thousands of examples.
|
|
|
|
|
Hello every buddy,
Can some one kindly explain me when a socket end point is disconnected what happens technically in the other point? How the other point is notified about this disconnection so it handles it?
Thank you so much
---
"Art happens when you least expect it."
|
|
|
|
|
I guess there will be some sort of timeout.
cool man
|
|
|
|
|
Can somebody point me to an article/tutorial about customizing controls? What I want to do is customize a ListBox by giving each item its own Tag property. I have a small idea about what I need to do. I made a new project and made my class inherit ListBox , but that is as much as I know. Do you think this is going to be very hard?
/\ |_ E X E GG
|
|
|
|
|
ListBox items are object s, so you _can_ already add an object that has a Tag property.
By overriding the object's ToString() method you can influence what the ListBox displays for each item.
Regards,
mav
|
|
|
|
|
You do not have to add Tag to listbox. Listbox already displays objects.
For example if you have:
class Customer
{
public FirstName { return this.firstName; };
public LastName { return this.lastName; };
...
}
then just add Custom to the listbox. So if in ListView you used Tag to get the data, for listbox you would just get the object:
Customer selectedCustomer = (Customer)listbox.SelectedItem;
if you want to display custom information, you can use DisplayMember. For example if you wanted to display first and last name, add to your Customer class:
public FirstLastName
{
get { return firstName + " " + lastName; }
}
and set in listbox:
listbox.DisplayMember = "FirstLastName";
|
|
|
|
|
Hey man, thanks for you help. I have made an implimentation of it below.
namespace listBoxTest
{
partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Customer customer=new Customer(this.textBox1.Text, this.textBox2.Text);
this.listBox1.Items.Add(customer.firstName);
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
Customer cust=(Customer)listBox1.SelectedItem;
this.asdfStatusStripPanel.Text=cust.firstName+" "+cust.lastName;
}
}
public class Customer
{
public string firstName;
public string lastName;
public Customer(string FirstName, string LastName)
{
firstName = FirstName;
lastName = LastName;
}
}
}
My question was regarding the code inside my listBox1_SelectedIndexChanged and the button1_Click methods. When I just add a Customer to the listBox all the code works fine, but I can't see any firstName or lastName in the listBox (which is completely understandable). Now, when I add a Customer.firstName , does that now copy the whole Customer object to the list, or does it just copy the firstName object? I think it just copyies the object (string) firstName , 'cause in listBox1_SelectedIndexChanged when I try to add the data to the class, I get an InvalidCastException .
Any idea how I can still add the (string) representation of the Customer.firstName to the ListBox, but still have access to the whole object (class) in the listBox1_SelectedIndexChanged method?
/\ |_ E X E GG
|
|
|
|
|
If you add Customer to listbox, it just copies reference to that customer.
When listbox displays the customer, first it checks if you set "DisplayMember" to display, if you did, it will display that property. If not, it will call "ToString()" on the object to display it.
IF you override ToString() on customer, you'd see in the listbox whathever you return from that method.
Or implement properties on Customer (getter method) and set DisplayMember to the name of that property.
You should add Customer to the list, then you can cast that object:
Customer cust = new ....;
listbox.Items.Add(cust);
...
Customer selectedCust = (Customer)listbox.SelectedItem;
to get first name, in customer have:
public string FirstName
{
get{ return this.firstName; }
}
and in Form1() constructor (below initialize)
listbox.DisplayMember = "FirstName";
and now just add customers to the listbox.
|
|
|
|
|
OK, I got it now. I'm alot smarter now too. Thanks for your help.
/\ |_ E X E GG
|
|
|
|
|
Hi guys
I was wondering if it's possible to use Microsoft Visual C# Standard edition for commercial in-house development? I only want Visual C# (preferrably Professional edition) but I don't want to fork out the extra cash to buy the whole VS.NET 2003 Professional.
|
|
|
|
|
Yes, the only one you can't do that with is the student edition.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Thanks for your help. Now I can save AUD$1500 and still develop commercially! Yay!
|
|
|
|
|
Hello,
I'd like to have a small gradient panel on the top of my application. I created a Custom Control and added this to OnPaint:
ColorBlend cBlend = new ColorBlend(2);
Color[] blendColors = {this.BackColor, SystemColors.ActiveBorder};
float[] pos = {.0f, 1f};
cBlend.Colors = blendColors;
cBlend.Positions = pos;
LinearGradientBrush brush = new LinearGradientBrush(e.ClipRectangle, blendColors[0], blendColors[1], LinearGradientMode.Horizontal);
brush.InterpolationColors = cBlend;
e.Graphics.Clear(this.BackColor);
e.Graphics.FillRectangle(brush, e.ClipRectangle);
It works nicely. But when I resize, I think it only repaint the a small part of the area, which makes it look odd.
Tried to catch the resize event, and did this:
Invalidate(this.ClientRectangle, false);
But apparantly, that wasn't enough.
Any ideas?
|
|
|
|
|
Don't use e.ClipRectangle for the area to fill (and the LinearGradientBrush) but this.ClientRectangle .
Then you can even remove your Resize event handler.
You should set the ResizeRedraw ControlStyle, though.
Regards,
mav
|
|
|
|
|
Hey.
How can i get the total machine RAM, ram used, etc?
Api?
Thanks.
|
|
|
|
|
using System.Management and then a PerformanceCounter
This is how I did it once... (Free Memory)
public int GetAvailableMemory()
{
PerformanceCounter ramCounter;
ramCounter = new PerformanceCounter("Memory", "Available MBytes");
int a=Convert.ToInt32(ramCounter.NextValue());
return a;
}
/\ |_ E X E GG
|
|
|
|
|
Also look for WMI articles in C# section in this site for other solution.
Mazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji
|
|
|
|
|
Maybe try checking the Environment Values. I think you can access them using the System.Environment namespace. It gives you access to all sorts of info, like OS version, current directory, and WorkingSet(I think this is mach ram).
Hope this helps 
|
|
|
|
|
My app is built on a model/view/controller pattern, which makes more sense when I'm not using the keyboard ( this app has 5 different controller classes, the keyboard one is only used for testing ). The keyboard controller exposes a keyboard event handler, which is subscribed to the OnKeyDown in the view, the view obvioulsy being a Form that has keyboard focus. This has worked fine for ages, in fact the app is nearly done. But on the weekend, the controller stopped recieving messages for the arrow keys, so I've had to map to i/j/k/m ( the first standby of any old Apple ][ coder ). It's got me beat how this could happen though, does anyone have any ideas ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
You can catch arrow key event in a form or custom control by overriding ProcessCmdKey method.
Under some circumstances (i'm not sure when) OnKeyDown/Up doesn't get called on arrow key events.
|
|
|
|
|
Thanks, I'll try that.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|