|
In my experience DllImport is not interested in the DLL at all (it is up to the programmer to make sure there eventually will be a DLL file and a function that matches with his prototype).
A C# app builds just fine without the DLL being present; and the calling code throws a DllNotFoundException at run-time whenever it doesn't find the DLL.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Good to know! Thanks Luc.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
You're welcome.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
|
Cool thank you!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
Iam using VS2010. I have 10 TextBoxes..
In TextBox1 I handled the event for GotFocus,LostFocus...like the following manner...
this.richTextBox1.GotFocus += new System.EventHandler(this.RichTextBox1_GotFocus);
this.richTextBox1.LostFocus += new System.EventHandler(this.RichTextBox1_LostFocus);
private void TextBox1_GotFocus(object sender, System.EventArgs e)
{
TextBox1.BackColor = Color.White;
}
private void TextBox1_LostFocus(object sender, System.EventArgs e)
{
TextBox1.BackColor = Color.LightSteelBlue;
} Like above I need to do all my Textboxes and I need to do the above codings, instead is it possible to have a common GotFocus,LostFocus to all Textboxes to do the above things?
Any Ideas?
Thanks & Regards
PARAMU
|
|
|
|
|
Sure, just wire the following handler to several textboxes:
private void tb_GotFocus(object sender, System.EventArgs e) {
TextBox tb=sender as TextBox;
if (tb!=null) tb.BackColor = Color.White;
}
You can do the wiring up at run-time, or using Visual Designer (click the event, choose an existing handler, after you added the above code, that is).
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
It's perfectly possible to hook multiple items up to one event handler. The sender argument is there to identify the control that raised the event, so you can easily do the following in your handlers:
private void HandleLostFocus(object sender, EventArgs e)
{
TextBox control = sender as TextBox;
if (control == null) return;
control.BackColor = Color.LightSteelBlue;
}
|
|
|
|
|
THanks... I Get Clear.
|
|
|
|
|
|
c# - I have a problem with webbrowser control loading local images from a html page(also local).
It does not matter if its a saved page from internet, or made by me... the same problem persist.
BUT, from internet it load the page correctly,all the images are displayed.
What is the catch? I know that I find a solution long time ago, but now I cant find it again... I search everywhere but with no luck. Maybe some luck from you? Thanks.
|
|
|
|
|
Without seeing the code it is hard to tell, but check paths for a start.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
I really don't think is for much help showing the code, but here it is:
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
StreamReader sr = new StreamReader(llistOfFileNames[listBox1.SelectedIndex].FullName);
webBrowser1.ScriptErrorsSuppressed = true;
webBrowser1.DocumentText = sr.ReadToEnd();
sr.Dispose();
}
modified on Sunday, May 22, 2011 10:44 AM
|
|
|
|
|
why don't you just provide a valid web page, something like:
object item=ListBox1.SelectedItem;
if (item!=null) webBrowser1.DocumentText="<html><body><img src='"+item+"'></body></html>";
BTW: SelectedIndexChanged will also fire when something gets deselected, possible causing unexpected values for SelectedIndex, SelectedItem, etc.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
modified on Sunday, May 22, 2011 11:38 AM
|
|
|
|
|
And if, for some reason, you don't have or don't want to use a local file, there is always this[^].
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
merlinq12 wrote: I really don't think is for much help showing the code, but here it is:
Show the related code - in this case HTML maybe?
Are URLs correct?
Does the hosting process have permissions to access the local images?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
there are pages saved from internet... nothing fancy... they open alright in firefox browser(just to be sure their links are working alright).
|
|
|
|
|
The best thing to do is provide the *fully* qualified path (or url) for the file in question.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
Hello,
I create 4000 files word like this :
foreach (string s in FUSIONSS_1)
{
String[] tbStr2 = s.Split(new Char[] { ';' });
string nb = tbStr2[0];
Object oMissing = System.Reflection.Missing.Value;
Object oTrue = true;
Object oFalse = false;
Microsoft.Office.Interop.Word.Application oWord = new Microsoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Word.Document oWordDoc = new Microsoft.Office.Interop.Word.Document();
oWord.Visible = true;
oWord.Visible = false;
Object oTemplatePath = modelee;
oWordDoc = oWord.Documents.Add(ref oTemplatePath, ref oMissing, ref oMissing, ref oMissing);
bool sympb = false; bool E = false; bool n = false; bool p = false; bool r = false;
foreach (Microsoft.Office.Interop.Word.Range range in oWordDoc.Words)
{if (range.Text.Trim().Contains("P"))
{ int pos = range.Text.Trim().IndexOf("P");
string str = range.Text.Trim().Replace("P", "O");
range.Text = str;} }
Directory.CreateDirectory((Object)path + "./PUBLI/" + nb);
Object oSaveAsFile = (Object)path + "./PUBLI/" + nb + "/" + nb + ".doc";
oWordDoc.SaveAs(ref oSaveAsFile, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing);
oWordDoc.Close(ref oFalse, ref oMissing, ref oMissing);
oWord.Quit(ref oMissing, ref oMissing, ref oMissing);
}
unfortunately the process winword.exe don't be kill on the task manager of my server.
How i can close the word file correctly?, thank you verry mutch.
|
|
|
|
|
|
Do you really need to create and dispose of the word application, and the other objects, 4000 times? Don't you think it would be better to do this outside of the loop?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Try changing the first oMissing to false.
abbd wrote: oWord.Quit(ref oMissing, ref oMissing, ref oMissing);
Word may be hanging on a hidden prompt to save changes or suchlike.
|
|
|
|
|
Unfortunately i have the same problem, please help me.
|
|
|
|
|
Well, I used to have a similar problem automating Excel in the same way. Best way to troubleshoot it is to NOT run it invisible for the time being. Then you can see what the problem might be.
|
|
|
|
|
Hello,
How in can run it invisible for the time being? please help me to resolve this great big problem.
|
|
|
|