|
Add a notify property changed event to the underlying data object. Register the event listener on the DataAdapter. If the event gets fired, show your message box. Otherwise, don't.
|
|
|
|
|
Hi there
I can't get Exchange webservice for Exchange 2007 SP1 working
http://msdn.microsoft.com/en-us/library/bb408417%28EXCHG.80%29.aspx[^]
when I run the following C# code:
ExchangeService service = new ExchangeService();
service.Credentials = new WebCredentials(@"username", "password", "domain");
service.AutodiscoverUrl("username@domain.co.za");
FindItemsResults<Item> findResults =
service.FindItems(WellKnownFolderName.Inbox,new ItemView(10));
foreach (Item item in findResults.Items)
{
}
It get this error:
Request failed. The remote server returned an error: (401) Unauthorized.
Any help will be greatly appreciate !!
Thanks in advance.
|
|
|
|
|
hello, can anyone help me with this?
|
|
|
|
|
Hi
I have a dialog form that has validation in it. If things are invalid, another window appears with the list of errors that they can double click on and be taken to the point of the error.
What I would like to do is not have this error window appear in the taskbar and have the window appear when the main dialog regains focus.
I've looked arround and tried this
private void Form1_Activated(object sender, EventArgs e)
{
if (newErrorForm != null)
{
newErrorForm.BringToFront();
this.Focus();
}
}
but this causes the error window to always have focus even though I'm shifting it back to the main form. Is there a way to achieve this?
Many ThanksThe FoZ
|
|
|
|
|
TheFoZ wrote: What I would like to do is not have this error window appear in the taskbar
There's an option "ShowInTaskbar" that stops that.
"If you can't explain it simply, you don't understand it well enough" ~ Albert Einstein
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." ~ Paul Neal "Red" Adair
Now reading: 'The Third Reich', by Michael Burleigh
|
|
|
|
|
I know, that is what's causing the problem. To only way to get the form back is to minimise the windows until you find it again. I just want the user to click on the dialogs button in the task bar and both windows appear. The FoZ
|
|
|
|
|
I'm making changes to a file, saving the edits to a StringBuilder, then writing the mods to a temporary file before deleting the original and then renaming the temporary file.
Now, I want to be able to determine what new line character(s) to use for the file being modified.
At the moment if I look at the changes made to a text file from a UNIX machine with WinMerge, it'll show that every line has been modified because of the AppendLine() method of the StringBuilder, which defaults to I'm guessing "\r\n" where UNIX uses "\n".
"That's fine, I'll just use Append(..) then Append("\n")..." I thought.
But then WinMerge will highlight the same issue for Windows based text files that require "\r\n".
Currently I use a StreamReader.ReadLine() to whip through each line of the file, but that just consumes the EOL characters so I can't determine it that way.
Do I really have to Peek() through the file until I come accross the "\n" or "\r\n",
or is there a smarter way to do it?
Thanks y'all.
"If you can't explain it simply, you don't understand it well enough" ~ Albert Einstein
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." ~ Paul Neal "Red" Adair
Now reading: 'The Third Reich', by Michael Burleigh
|
|
|
|
|
Hi,
here are some facts that should help you out:
- Environment.NewLine (read-only) holds the line terminator used on your system; you can't change it;
- StringBuilder.AppendLine relies on Environment.NewLine;
- TextWriter is an output text stream that has a NewLine property, which you can set;
- TextReader is an input text stream that is tolerant to all kinds of line terminators (but doesn't tell you which ones it sees).
So you probably should read your file with TextReader, write the new one with TextWriter, and not just rely on StringBuilder. AFAIK the text streams are buffered, so going through a StringBuilder isn't paying off, just do TextWriter.Write instead of StringBuilder.Append
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
Hhmmmmmmm...interesting.
Thanks Luc, I shall look at the TextReader/Writer classes and see what I can find.
The main thing I'm trying to do is just to find out what EOL terminator the file is using,
and then use the same again for the 'modified' file.
"If you can't explain it simply, you don't understand it well enough" ~ Albert Einstein
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." ~ Paul Neal "Red" Adair
Now reading: 'The Third Reich', by Michael Burleigh
|
|
|
|
|
OK, been there. First read (part of) the file in binary, looking for \n and \r, and make up your mind. Then start using TextReader and TextWriter.
BTW: what if the input file's NewLine is inconsistent?
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
Luc Pattyn wrote: BTW: what if the input file's NewLine is inconsistent?
Then...I start to cry.
As I would have to go through each line, then look for the appropriate EOL terminators,
then use that EOL for the modified file.
I thought this would be easy!
Where are those tissues...
"If you can't explain it simply, you don't understand it well enough" ~ Albert Einstein
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." ~ Paul Neal "Red" Adair
Now reading: 'The Third Reich', by Michael Burleigh
|
|
|
|
|
it gets easy once you have all the requirements in front of you.
are you also considering ANSI/UTF8/Unicode, and the byte-order-mask?
TextReader may happily skip over those...
(and what if the original doesn't support the kind of change you want to apply?)
Have a look at StreamWriter, it takes an Encoding...
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
Yeah, well, currently I have a StreamReader on the source file, and then a StreamWriter on the 'modified' file.
I've set the StreamWriter to have the same Encoding as the StreamReader.
As far as the 'byte-order-mask' goes, I have no idea what that is.
"If you can't explain it simply, you don't understand it well enough" ~ Albert Einstein
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." ~ Paul Neal "Red" Adair
Now reading: 'The Third Reich', by Michael Burleigh
|
|
|
|
|
the BOM is an optional 2- or 3-byte code prefixed to the actual text, and indicating the file is encoded using UTF8 or some kind of Unicode; have a look at some text files with a hex viewer.
You could use Notepad (watch the bottom part of the Save File Dialog) to force a particular encoding, at least since Vista.
Most classes deal with BOM automatically, without telling you. If you're not careful, you might add or remove the BOM without even realizing.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
Woah, I never knew that.
I shall google hence forth and see what I can find.
Thanks for the information Luc.
"If you can't explain it simply, you don't understand it well enough" ~ Albert Einstein
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." ~ Paul Neal "Red" Adair
Now reading: 'The Third Reich', by Michael Burleigh
|
|
|
|
|
The XP version of notepad has it too
|
|
|
|
|
If you knew what sort of system they were using to create the file you might be able to code around that.
New Line info[^]
Possibly the best explanation I have ever seen for what the heck happened with new lines.
|
|
|
|
|
Thanks, yeah I've had a peruse through that link as well - very interesting.
The trouble is the files could come from any system, I've got some files from a UNIX system, but have run the modification functionality on windows file as well.
I, stupidly, thought that it would be a simple thing to do...
"If you can't explain it simply, you don't understand it well enough" ~ Albert Einstein
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." ~ Paul Neal "Red" Adair
Now reading: 'The Third Reich', by Michael Burleigh
|
|
|
|
|
1.21 Gigawatts wrote: The trouble is the files could come from any system, I've got some files from a UNIX system, but have run the modification functionality on windows file as well.
Dear lord I am so sorry.
Good luck.
|
|
|
|
|
Ignoring the issue of byte-order marks, you could try this:
1. Open the file with a StreamReader
2. Read the first line
3. Compare StreamReader.BaseStream.Position with line length
This may be able to distinguish between \n and \r\n but of course doesn't really help if you could have \r.
As an (simpler) alternative, is there some way to make WinMerge ignore line-ending changes?
|
|
|
|
|
Gideon Engelberth wrote: As an (simpler) alternative, is there some way to make WinMerge ignore line-ending changes?
Yeah there is, but it's hiding the problem, rather than finding the solution to it.
I don't want to use the wrong EOL terminator for a UNIX file and then that system not being able to read the file correctly.
But as far as the BaseStream.StreamPosition goes, I hadn't thought of that.
Thanks for the info.
"If you can't explain it simply, you don't understand it well enough" ~ Albert Einstein
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." ~ Paul Neal "Red" Adair
Now reading: 'The Third Reich', by Michael Burleigh
|
|
|
|
|
generally speaking, if you are writing an install program, how would you ensure that a computer has a required installation prerequisite (i.e. MySql)?
in development, i add a reference to a DLL to get the MySQL libraries. in an installation environment, would the install program look for that DLL (through COM for example), or would I need to include the required DLL with the install?
|
|
|
|
|
HI All!
i have a panel on which i am drwaing a image control on the center of panel, now when i zoom the image i am resizing the control's left, top , height and width, now when i get negative left and top values the image gets cropped from top Image gets cropped from the top but the bottom scroll bars appears.. is there any way so that when i set the values of my image control to negative(i.e left and top) still the scroll bars appear for that control!!
Thanks in Advance
Samir
|
|
|
|
|
Hello,
i am very new to C# so please be patient.
i am printing orders in my app.
so i have a button which creates the printjob.
the paper will be written in the Printpage-Event.
now i want to have a function that gets th order-object as a parm
and print it on the paper.
the reason is, that an order must be printed on severall programm modules.
private void btnDruck_Click(object sender, EventArgs e)
{
PrintDocument Druckjob = new PrintDocument();
PrintDialog Druckermenue = new PrintDialog();
PrintPreviewDialog Druckpreview = new PrintPreviewDialog();
Druckjob.DocumentName = "Rechnung";
Druckjob.PrintPage += new PrintPageEventHandler(Druckjob_PrintPage);
Druckpreview.Document = Druckjob;
Druckermenue.Document = Druckjob;
if (Druckermenue.ShowDialog() == DialogResult.OK)
{
Druckjob.Print();
}
Druckjob.PrintPage -= new PrintPageEventHandler(Druckjob_PrintPage);
}
void Druckjob_PrintPage(object sender, PrintPageEventArgs e)
{
Graphics g = e.Graphics;
StringFormat lineFmtRight = new StringFormat();
lineFmtRight.Alignment = StringAlignment.Far;
g.PageUnit = GraphicsUnit.Millimeter;
g.Dispose();
}
bye jo
|
|
|
|
|
Can any body tell me with an example, how loose coupling is implemented in c# in a such a way that if a class is implementing some interface and if we change something in that class then consumer class doesn't gets effected and without using interface how all the classes consumer class is changed if we didnot implemen using interface.
|
|
|
|