|
I had this happen to me when I was calling the Response object from an event fired from an IFrame .Inside the IFrame's Unload event I was doing a Redirect and it gave me this same error.
To fix it I had to just set a variable (boolean for me) in the unload event and watch for it in a different function
for example
bool isDone = false;
private void iFrame_Unload(object sender, e EventArgs)
{
isDone = true;
}
private void watchForDone()
{
if(isDone == true)
{
Response.Redirect("blah.aspx");
}
}
to better explain it, you have to move the Response.Redirect out of that function.
Steve Welborn
|
|
|
|
|
I need to open up multiple .doc files and merge them into one without opening WORD.
I am able to open the file for read and write to a temp file, but what I am having problems with is keeping the same format when copying.
Anyone know how to know if a word is bold, italic, underlined, etc and how to copy that into the temp file?
I'm doing a ReadLine() to get the text, I checked the string and its just words, nothing that will tell me if it's bold or not.
Thanks
Steve Welborn
|
|
|
|
|
This is because most of the Office apps use multiple stream files, otherwise known as OLE 2.0 docFiles. When using the FileStream objects, your restricted to seeing, and manipulating, the primary stream. You're missing most of the file, and most likely the formatting information, using your method.
For a taste of what your not seeing, check this[^] out.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-- modified at 21:59 Wednesday 18th January, 2006
|
|
|
|
|
Interesting information here thanks.
I think im just going to ask the client to stick with the RichText format rather than standard Word file. Much easier to work with and I can view what's bold and what's not.
Have a great day.
Steve Welborn
|
|
|
|
|
Hi,
Before I go into detail, is there any way to force a button to get that dotted box on it that shows it's in focus? Just saying btn1.Focus(); isn't working for me. Btn1 is definitely the thing being focused on, but you wouldn't know by just looking at it. And it seems that the only way to get a button to show highlight is to Tab into it.
So, the weird details...
Say I put a custom button on my form (and gave it tabstop 1). I then add a textbox with tabstop 2. And finally another button (tabstop 3). If I click in the textbox and press the Tab key, the 2nd button gets that dotted line, no problem. Same goes if I press Shift-Tab (the 1st button shows focus). I made the textbox so that it recognizes if the up or down keys are hit, so when I'm in the textbox and press the up key, I say:
if (e.KeyCode == Keys.Up){SendKeys.Send("+{Tab}");}
and have no problem here either - the first button shows focus.
But if down is pressed:
if (e.KeyCode == Keys.Down){SendKeys.Send("{Tab}");}
it freaks out and everything freezes so that I have to open task manager to close it down.
One other thing - if a button has been highlighted (tabbed into) once, saying just btn1.Focus(); is enough. But, of course, I can't be sure that tab will always be pressed.
Hope this makes sense.
Thanks for any help on this!
Mel
|
|
|
|
|
It just hit me that the buttons I'm using are custom and descend from the checkbox class. Hopefully this will make more sense out of things, but I'd still like to know how to make it look in focus.
Thanks!
Mel
|
|
|
|
|
hi!
you can try this one:
<br />
protected override void OnPaint(PaintEventArgs e)<br />
{<br />
base.OnPaint(e);<br />
<br />
if(this.Focused) <br />
{<br />
Rectangle rec = new Rectangle(1, 1, Width - 2 , Height - 2);<br />
}<br />
ControlPaint.DrawFocusRectangle(e.Graphics, rec, ForeColor, BackColor);<br />
}<br />
}<br />
hope that helps!
|
|
|
|
|
Okay, looking through a book "Microsoft Visual C# 2005 Step by Step" 2005 Edition form Microsoft at the binary tree class they try to setup. I'm using Visual Studio 2003 to try to compile the code, but they said to use 2005. This code right here doesn't work
<br />
public class Tree<T> where T : Icomparable<T><br />
Is this code specific to 2005 Visual Studio? Do I even need to use "<t>"? Can anybody point me in the right direction. I will be creating a binary tree visaulizer program that draws out the different nodes and branches. What fun?
Any ideas or comments are greatly appreciated.
Thanks,
Josh
|
|
|
|
|
The code used in the book doesn't work because they are making a generic class, and it only works in C# 2.0 that comes with Visual Studio 2005. The class can be modified so it can compile with VS 2003, but you will need to change all the code that uses the class.
Hope this helps
Pablo Hernandez Valdes
|
|
|
|
|
http://s18.yousendit.com/d.aspx?id=1BV73LUSO19IV1DGQM7SI2RUVO
Here is a link to download my project. This is a school project and I've been working on it for a while. I tried a few ways to export my treeview to xml but they haven't quite been right. I need to export my server list as an XML when I close the ServerForm. Will someone please help me out here?
Eric W.
-- modified at 11:15 Wednesday 18th January, 2006
|
|
|
|
|
Why XML? Can't you export your treeview as a persisting object to disk, i.e. using an ObjectFiler, BinaryFormatter or native object database?
Regards
|
|
|
|
|
I haven't tried anything else. I will have to try those thanks zopiro.
|
|
|
|
|
I have a C# DLL that a VB6 app is making a call into. That DLL then starts a thread and returns immediately.
I need for the DLL to raise an event when the thread completes.
I can't use the BeginInvoke technique to start the thread, because I need to override the apartment mode to STA, as interactions with COM objects was failing with "QueryInterface failed".
Therefore, I am using an explicit thread creation, which doesn't seem to provide a callback mechanism.
I can raise a message from the main thread just fine.
I can't raise a message from the worker thread; I get "Object does not match target type".
Is there way that I can invoke a function on the main thread from within the worker thread so that the event originates from the main thread?
Thank you.
|
|
|
|
|
I wrote an application in which i called crystal report 10 in my Asp.net(C#)
in crystalreportviewer.Now i want to give users functionality of print that crystal reports on client side.have any body idea to do this job.
|
|
|
|
|
i search this topic. and i used codes which is posted before.(about setstyle) However my form flicker. I draw an image, and some lines and points on the same form. So when i refresh it, it flicker.
How can i solve it ?
|
|
|
|
|
Did you override OnPaint to do the drawing yourself? Did you call SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true) in the form's constructor?
That will work if you do it correctly. Worse comes to worse, just draw to a bitmap, then draw that bitmap to the screen, which will prevent flickering.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Little House on the Flickr
Judah Himango
|
|
|
|
|
thanks. I try to do it again, and i find a mistake. If you dont say this. May be i dont find. Thanksss again...
|
|
|
|
|
I have RichTextBox that i want to add an animated picture within it and i can be able to insert that picture wherever in a string as the that of yahoo messenger during private or public chatting i succeeded to insert it but non animated even if the picture is animated one but also the picture can be resized with the mouse of the user when he hold it the user can resize it but i don't want it to be resized and i want it to be animated if it is for example .Gif Picture. and to have the ability to insert it in any place within the string entered
How can i do that ?
Thanks everybody - "Human Knowledge belongs to the world"
|
|
|
|
|
That was the longest run-on sentence I've ever seen; it caused me a good deal of pain to read that. Your English could use some help; but I'll assume you're not a native English speaker so I'll try to answer your question anyways.
The RichTextBox probably won't do everything you want it to do out-of-the-box; you're going to have to dig into some Win32 interop to get it to do things differently. Have you read the CP article[^] on customizing the RTB? There's another article on it here[^] that may help you as well.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Little House on the Flickr
Judah Himango
|
|
|
|
|
How Can i make the TreeView Nodes start from the right edge of the control with C# ?
M.Gamal
|
|
|
|
|
myTreeView.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
myTreeView.RightToLeftLayout = true;
|
|
|
|
|
"TreeView dosnt contain RightToLeft RightToLeftLayout"
Iam using C# ,and I get this Error when using MyTreeView.RightToLeftLayout = true;
|
|
|
|
|
Hi
I hope someone in here can help me with this issue.
I am trying to write a little application that will give me the information of the directory which is there in the network.
I am able to get the local directory information, but when I tried to access the information of the directory which is in some other
system of the same network I am getting Exception as "Logon failure: unknown user name or bad password."
In fact the directory which I am trying to access is created by myself using another console application.
Here is my code snippet,
DirectoryInfo dir = null;
FileInfo[] xmlFiles;
//get the directory info,
//here test machine is a network machine under same domain
dir = new DirectoryInfo("\\\\TestMachine\\Indexes\\");
//get the information about the subdirectories of dir.
DirectoryInfo[] subDirectories = dir.GetDirectories();
when I try to execute this GetDirectories() method its says "Logon failure: unknown user name or bad password."
So, am doing anything wrong in this code? or is there any other solution to get the directory Info?
Expecting some solution.
Thanks in advance.
Hans.
|
|
|
|
|
The Genghis Framework[^], which is free and built on top of the .NET framework, includes functionality for accessing shares and password protected shares.
Also, you can use WNetUseConnection[^] from the PlatformSDK via P/Invoke.
|
|
|
|
|
Basically, the remote machine doesn't trust you. You're trying to get the directory of a share on a machine that is not part of the same domain as the machine your code is running on. The SID that you logged in under on your machine isn't known to the remote machine and there is no way for it to know that it can be trusted, so it denies your "implied" login attempt.
You have to establish an authenticated connection to the remote machine before you attempt any file operations on one of its shares. You can use the library Judah suggested to establish the authenticated connection, but you still have to supply it with a username and password that the remote machine will accept as valid.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|