|
Hello all,
Has anyone got any idea on how to use the Outlook database through my C# application?
I want to retrieve the Task entries from Outlook XP to my Access database and then use them on an ASP.NET application using C#.
Is there an API that MS provides?
Thank you.
theJazzyBrain
Wise is he who asks good questions, not he who gives good answers
|
|
|
|
|
If you are using Outlook 2002 Why not use the Office 10 Primary Interop Assemblies provided by Microsoft.
You can download them here[^]
A good starting point for installing them and using them can be found here[^]
|
|
|
|
|
Hi,
I have a class that has a get property, Edges that returns an ArrayList. Due to the internal organization of what the class does I want to disallow people getting the property and then adding stuff to it. I want them to use the Add method of the class instead. I could document it and say "dont do that" but I was wondering if there is a way to do it in C#. I can't think of one. Here is some code
public class foo
{
private ArrayList _edges;
public ArrayList Edges
{
get { return _edges; }
}
public void Add(string myString)
{
_edges.Add(myString);
}
}
//I want to prevent the following
foo myFoo = new foo();
//The next statement should throw an exception or something
myFoo.Edges.Add("Hello");
//the following instead should be used.
myFoo.Add("Hello2");
Thanks,
Rahul
|
|
|
|
|
..ehr... pass them deep copies in the returned ArrayList ?
<br />
public ArrayList Edges<br />
{<br />
get<br />
{<br />
ArrayList r = new ArrayList();<br />
foreach(Edge e in this._edges)<br />
r.Add(e.DeepCopy());<br />
return r;<br />
}<br />
}<br />
<br />
Granted, your Edge class has to have a public method to provide a DeepCopy.
I usually use the Clone() method for that.
<br />
public Edge Clone()<br />
{ return new Edge(this); }<br />
<br />
public Edge(Edge rhs)<br />
{<br />
}<br />
[shameless self plug]
I actually use this kind of thing in CFGLite:
http://www.codeproject.com/csharp/CFGLitepack.asp
[/shameless self plug]
HTH,
F.O.R.
|
|
|
|
|
|
leppie wrote:
Hmm didnt we cover this just a few days ago.....
I do think so... If he just used the "great" CP search engine...
You can do it on anything you choose - from .bat to .net - A customer
|
|
|
|
|
If you did cover this a few days ago how about posting a link.
If you dont remember the link you can use the Codeproject Search engine to find it. I did that but couldnt find it.
Maybe you will have better luck.
Cheers,
Rahul
|
|
|
|
|
Ok I found it.
But I had to go through all the entries by hand.
Here is a link
http://www.codeproject.com/script/comments/forums.asp?forumid=1649&select=593349&df=100&fr=101#xx593349xx
Thanks.
|
|
|
|
|
Rahul Singh wrote:
Ok I found it.
But I had to go through all the entries by hand.
Here is a link
Sorry, I was joking about CP search engine, and meant that you hadn't found because, as you discovered by yourself, CP search engine sucks most of the time.
You can do it on anything you choose - from .bat to .net - A customer
|
|
|
|
|
|
How do I create a reference to a COM Enabled .NET Managed Assembly registered through Component Services on Windows XP?
Please HELP?
|
|
|
|
|
I need to create pseduo columns with my tree view. like using draw string to control the text output.
any got ideas, pointers, or links?
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Can anyone give some insight on the best practices of how/where to use dataadapters and connections in a multi-form application. Most examples I have seen have been 1 form examples and dont really explain how to work with "common" dataadapters. I mostly work with Delphi and it has a DataModule form in which you can locate all of you data connections and each form can access the data thru the datamodule.
Thank you
|
|
|
|
|
Does anybody know where I can find a free class parser in C#?
Thanks
|
|
|
|
|
What do you mean by "class parser" ?
The Reflection namespace should let you do almost everything you may need to do programmatically...
If you need a C# parser, I think there is something in one of the CLR classes (search for "Parser" ?), and you may find something online, but the last time I looked for that, I decided I would have been better off making my own Parser anyway...
Finally, if you just want something that lets you look at classes (like the Object Browser in VS), ..ehr... you can make your own by using the Reflection namespace.
HTH,
F.O.R.
|
|
|
|
|
|
..hmmm... interesting.
Maybe that's part of why I figured I was going to be better off doing my own Parser for C#
[whisper in the dark]
..the mono project might have something useful...
[/whisper]
..what was that ?
Well, anyway, I have not had time to actually try and work with the GetParser
and built-in Parsers...
if I'll find something, I'll let you know.
F.O.R.
|
|
|
|
|
Frank Olorin Rizzi wrote:
[whisper in the dark]
..the mono project might have something useful...
[/whisper]
Yes, if you can make anythin from that mess. I suggest look at DotGNU rather, and use their excellent TreeCC parser/compiler compiler. And the C# language definition is already provided. That said. Learning to read and write grammars is a beast of it own, and I would not suggest it until you have mastered regular expressions.
There are many good manual/tutorials on Flex/Bison. A C# grammar for is bound to be around somewhere.
leppie::AllocCPArticle("Zee blog");
|
|
|
|
|
..well, while I agree that a C# grammar is probably available somewhere and ready to be used with Flex/Bison or what have you,
I don't find "reading a grammar" such a hassle.
The fact that you mention regExes makes me wonder if you're thinking about tokenization, rather than parsing-per se.
Sure, tokenization may be a hassle, but once you solve the problem,
parsing becomes a much more manageable problem, I think.
After all, at the worst, you can do a Recursive Descent Parser (dumb, brute force kind of approach).. sure, it's probably not the fastest approach, but it works!
Anyway, good luck on finding a grammar for C# (maybe the M$ site has something like that?)..
and be sure to share when you find it
F.O.R.
|
|
|
|
|
Frank Olorin Rizzi wrote:
The fact that you mention regExes makes me wonder if you're thinking about tokenization, rather than parsing-per se.
Lexing/Parseing I refer to both allways. Where by a grammar refers to the actual parser bit. But that makes me think...why are you telling me all this? I wasnt the one asking the question.
leppie::AllocCPArticle("Zee blog");
|
|
|
|
|
hi,
i have set the DataGridColumnStyle in my datagrid of DateTimePicker control...but the problem is i unable to preserve data in cell....when i change the focus from the cell....pls tell me what should i do? code is given below...
-bhavin
using System;
using System.Data;
using System.Windows.Forms;
using System.Drawing;
// This example shows how to create your own column style that
// hosts a control, in this case, a DateTimePicker.
public class DataGridTimePickerColumn : DataGridColumnStyle
{
private DateTimePicker myDateTimePicker = new DateTimePicker();
// The isEditing field tracks whether or not the user is
// editing data with the hosted control.
private bool isEditing;
public DataGridTimePickerColumn() : base()
{
myDateTimePicker.Visible = false;
myDateTimePicker.Dock=DockStyle.Fill;
}
protected override void Abort(int rowNum)
{
isEditing = false;
myDateTimePicker.ValueChanged -=
new EventHandler(TimePickerValueChanged);
Invalidate();
}
protected override bool Commit
(CurrencyManager dataSource, int rowNum)
{
myDateTimePicker.Bounds = Rectangle.Empty;
myDateTimePicker.ValueChanged -=
new EventHandler(TimePickerValueChanged);
if (!isEditing)
return true;
isEditing = false;
try
{
DateTime value = myDateTimePicker.Value;
SetColumnValueAtRow(dataSource, rowNum, value);
}
catch (Exception)
{
Abort(rowNum);
return false;
}
Invalidate();
return true;
}
protected override void Edit(
CurrencyManager source,
int rowNum,
Rectangle bounds,
bool readOnly,
string instantText,
bool cellIsVisible)
{
DateTime value = (DateTime)
GetColumnValueAtRow(source, rowNum);
if (cellIsVisible)
{
myDateTimePicker.Bounds = new Rectangle
(bounds.X + 2, bounds.Y + 2,
bounds.Width - 4, bounds.Height - 4);
myDateTimePicker.Value = value;
myDateTimePicker.Visible = true;
myDateTimePicker.ValueChanged +=
new EventHandler(TimePickerValueChanged);
}
else
{
myDateTimePicker.Value = value;
myDateTimePicker.Visible = false;
}
if (myDateTimePicker.Visible)
DataGridTableStyle.DataGrid.Invalidate(bounds);
}
protected override Size GetPreferredSize(
Graphics g,
object value)
{
return new Size(100, myDateTimePicker.PreferredHeight + 4);
}
protected override int GetMinimumHeight()
{
return myDateTimePicker.PreferredHeight + 4;
}
protected override int GetPreferredHeight(Graphics g,
object value)
{
return myDateTimePicker.PreferredHeight + 4;
}
protected override void Paint(Graphics g,
Rectangle bounds,
CurrencyManager source,
int rowNum)
{
Paint(g, bounds, source, rowNum, false);
}
protected override void Paint(
Graphics g,
Rectangle bounds,
CurrencyManager source,
int rowNum,
bool alignToRight)
{
Paint(
g,bounds,
source,
rowNum,
Brushes.Red,
Brushes.Blue,
alignToRight);
}
protected override void Paint(
Graphics g,
Rectangle bounds,
CurrencyManager source,
int rowNum,
Brush backBrush,
Brush foreBrush,
bool alignToRight)
{
DateTime date = (DateTime)
GetColumnValueAtRow(source, rowNum);
Rectangle rect = bounds;
g.FillRectangle(backBrush,rect);
rect.Offset(0, 2);
rect.Height -= 2;
g.DrawString(date.ToString("d"),
this.DataGridTableStyle.DataGrid.Font,
foreBrush, rect);
}
protected override void SetDataGridInColumn(DataGrid value)
{
base.SetDataGridInColumn(value);
if (myDateTimePicker.Parent != null)
{
myDateTimePicker.Parent.Controls.Remove
(myDateTimePicker);
}
if (value != null)
{
value.Controls.Add(myDateTimePicker);
}
}
private void TimePickerValueChanged(object sender, EventArgs e)
{
this.isEditing = true;
base.ColumnStartedEditing(myDateTimePicker);
}
}
|
|
|
|
|
Hello,
I have a database where I store points by memorizing their coordinated in two columns namely x and y.
I have written a method that allows the user to insert two arbitrary coordinates (x,y) and the method will return all the points in a 1,5,10,..n km radius.
With these query result I want to find the point with the smallest x coordinate, the point with the greatest x coordinate, that with the smallest y coordinate, and that with the greatest y coordinate.
I need to do this in order to be able to fit all the area that has been returned into a 200x200 pixels area.
The first idea that I got is to sort the dataset by column x and extract the first and last record, then sort again by y column and do the same.
Is there any better way to achieve this? I need fast performance because the program will be computing thousands of query from different users at the same time.
Thanks in advance,
Edo
|
|
|
|
|
Well, firstly you can use the SQL Aggregation functions MIN and MAX on the columns... i.e. SELECT MAX(xCord) FROM Coords .
If you want to tie it into one query you'll probably have to start using sub-queries.
Performance wise, I'm not sure how you'll optimise it. The only other alternative would be to re-visit the design so that if it's read-intensive that the majority of the calculations etc. are done during an insert or update, whether that's possible (and how it might be so) is dependent upon the application and design, sorry to be so vague
--
Paul
"Put the key of despair into the lock of apathy. Turn the knob of mediocrity slowly and open the gates of despondency - welcome to a day in the average office."
- David Brent, from "The Office"
MS Messenger: paul@oobaloo.co.uk
Download my PGP public key
|
|
|
|
|
I wrote to a StreamWriter sitting on top of a NetworkStream, but calling Flush() didn't help get the data to the client. I understand that NetworkStream doesn't buffer and NetworkStream. Flush doesn't actually do anything - data written did not get flushed to client.
But, it is StreamWriter.Flush() that I called. To resolve the problem, I just called Close on StreamWriter - which calls flush internally according to MSDN. Data is flushed to client side.
Any idea?
norm
|
|
|
|
|
Actually, see the constructors for StreamWriter: they do buffer, and if you use Reflector, they use a default buffer size of 1024. Try creating a StreamWriter specifying a buffer size of 0, and see if it helps.
You can do it on anything you choose - from .bat to .net - A customer
|
|
|
|
|