|
Run Visual Studio As Administrator.
If you can think then I Can.
|
|
|
|
|
eg_Anubhava wrote: Run Visual Studio As Administrator.
According to the title bar of C#, that's what I'm doing - it says "(Administrator)".
|
|
|
|
|
I have some place in my code that i update my database(using Access db).
After i did this update - i try to get from some other place in my code the fresh data from this database.
For some reason i see that i get the old database data (i get the data before i update this database). But when i add some sleeping time (Thread.Sleep(5000)) before getting the fresh data i see that the data was update correctly.
How can i fix this problem ?
How can i know if the update of the database table was done ?
|
|
|
|
|
Are you using a separate thread to update the database.
If so, Use ManualResetEvent object to Set when update is successfully done.
And in the main thread use WaitOne function to wait until the child thread finishes its job.
You can also use Thread.Join to do this as well.
|
|
|
|
|
No,
In my application i have only one thread, so its does not look like thread synchronize problem.
|
|
|
|
|
|
No - as the program will be in use!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
As Dave said - no, but why on earth would you want to do this? The only reason I can see for this would be to try to put something malicious on a machine which removes itself when it's completed it's nefarious purpose. As you earlier posted about wanting to write a key logger, I'm highly suspicious of what you are hoping to accomplish.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Please stop deleting your messages, just because you don't like the answers you're getting.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
|
nike_arh wrote: Hi! I recently started working on internet applications. I wondered what is the principle behind programs like TeamViewer. How do they work, because I'm interested in making my own similar program.
Errrm. You did see the honking great bit of text at the top that said this was the C# forum didn't you? I mean - I can see that it would be easy to miss, what with it being twice as big as the rest of the text and green. I mean, c'mon; couldn't they have made it any more apparent that this section was about C# code and nothing whatsoever to do with asking questions about commercial applications?
Would you like to go away now, or shall I mock you some more?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Pete O'Hanlon wrote: Would you like to go away now, or shall I mock you some more?
You sons of a silly person!
Man who stand on hill with mouth open wait long time for roast duck to drop in
|
|
|
|
|
More! More!
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Jörgen Sigvardsson wrote: What's your beef with this guy? He wasn't rude, he didn't ask you to do his homework, and he didn't offend anyone.
|
|
|
|
|
Hello,
I have 3 types of resources embeded in my executable :
html, jpg and pdf. I also have a listbox, and I want whenever a user sleects a different item, to display it in a web browser.
I have no problems doing that to HTML files, but with the other one, it's a different thing and I hope someone can help me do this.
First, I want to say that I don't want to save the resources locally and after that load them in the browser, because I don't want users to see them.
I am using this to view the html :
<br />
Assembly assembly = Assembly.GetExecutingAssembly();<br />
webBrowser1.DocumentStream = assembly.GetManifestResourceStream("ebook.index.html");
If I try to do the same thing to the pdf or jpg, it simply shows me the binary data of the files, it does not display them in the browser.
Is it possible to make the visible in the browser, directly from the assembly ? What are my options ?
Thank you
|
|
|
|
|
Hi,
I haven't done this myself, but the way I understand it you must also set the WebBrowser.DocumentType (try "application/pdf"); that should allow you to view a PDF document (or any image) as a web page.
You probably also want images inside web pages, so have a look at embedded images[^].
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hello,
Thank you for the quick reply but unfortunatly the DocumentType is read only
Any other ideeas ?
Thanx
|
|
|
|
|
Yes, you are right.
And the data scheme[^] is usable only for small amounts of data, hence small images only, no PDF documents.
I guess the next logical approach is to come up with a simple HTTP server that can provide HTML and PDF; then embed that in the app, andmake the WebBrowser navigate to it.
This seems to be a candidate: Sample HTTP Server Skeleton in C#[^]
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi,
I now have a simple embedded HTTP server working based on the article I provided a link to.
It gets a PDF document somewhere (from a file!), then serves that to its client, which can be either a regular browser (e.g. FireFox) or a WebBrowser. It still needs a lot of clean-up though, but I wanted to confirm you can make it work.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Thank you very much for your help
|
|
|
|
|
Hi
I want my application to update itself. As far as I know we can't do this in C# ( or any other language -without workarounds- ) because a file can't change itself while running.
I tried using another method which first downloads the newer executable, creates a batch file which waits for a while for the application to terminate then deletes the main app and replaces it with the newer one, then launches it.
But there is something wrong here I think. The batch file doesn't do everything correctly. Sometimes it doesn't delete itself or the update file, or sometimes newer does anything.
Class:
class updater
{
public string UpdaterURL = null;
public string LocalUpdaterLocation = null;
public int ErrorCounter = 0;
public void Download()
{
if (ErrorCounter == 0)
{
WebClient wc = null;
try
{
wc = new WebClient();
wc.DownloadFile(UpdaterURL, LocalUpdaterLocation);
}
catch { ErrorCounter++; }
finally { if (wc != null) wc.Dispose(); }
}
}
public void CreateBatchFile()
{
if (ErrorCounter == 0)
{
string AppPath = Application.ExecutablePath.Replace(Application.StartupPath, "").Replace(@"\", "");
StreamWriter sw = null;
try
{
sw = new StreamWriter("update.bat");
sw.WriteLine("@echo off");
sw.WriteLine("ping 127.0.0.1 -n 2 -w 1000 > nul");
sw.WriteLine("ping 127.0.0.1 -n 2 -w 1000 > nul");
sw.WriteLine("ping 127.0.0.1 -n 2 -w 1000 > nul");
sw.WriteLine("ping 127.0.0.1 -n 2 -w 1000 > nul");
sw.WriteLine("ping 127.0.0.1 -n 2 -w 1000 > nul");
sw.WriteLine("ping 127.0.0.1 -n 2 -w 1000 > nul");
sw.WriteLine("ping 127.0.0.1 -n 2 -w 1000 > nul");
sw.WriteLine("ping 127.0.0.1 -n 2 -w 1000 > nul");
sw.WriteLine("ping 127.0.0.1 -n 2 -w 1000 > nul");
sw.WriteLine("ping 127.0.0.1 -n 2 -w 1000 > nul");
sw.WriteLine("deleteexe:");
sw.WriteLine(@"del """ + AppPath + @"""/Q/S>nul");
sw.WriteLine(@"if exists """ + AppPath + @""" goto deleteexe");
sw.WriteLine("rename " + LocalUpdaterLocation + " " + AppPath);
sw.WriteLine(AppPath);
}
catch { ErrorCounter++; }
finally { if (sw != null) { sw.Close(); sw.Dispose(); } }
}
}
public void StartUpdating()
{
if (ErrorCounter == 0)
{
Process prc = new Process();
prc.StartInfo.FileName = "update.bat";
prc.StartInfo.ErrorDialog = false;
prc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
prc.Start();
Environment.Exit(0);
}
}
}
How I call it:
updater upd = new updater();
upd.UpdaterURL = "http://.../update.exe";
upd.LocalUpdaterLocation = "update.exe";
upd.ErrorCounter = 0;
upd.Download();
upd.CreateBatchFile();
upd.StartUpdating();
Thanks in advance,
Can
|
|
|
|
|
|
Thank you for your answer.
I have read that article you have linked. It is a sophisticated solution. But there is only one problem, There should be an AppStart.exe to start the updated solution.
I can only have one executable, that's why I was trying to work with batch files.
|
|
|
|
|
Hi people!
I don´t know how make a functionality to write text in a multiline richtext o multiline textbox, and set maxlenght property depending of width and height of the control. ( the control take diferent sizes in runtime ).
I´m using MeasureString method of System.Drawing.Graphics, but I don´t know if is the correct way.
Somebody know something ,please?
I home your help,
best regards.
PS: sorry for my english
|
|
|
|
|
Can you not set the ScrollBars property to either Horizontal , Vertical or Both .
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|