|
The files are only small empty classes in a dll file for testing and text files.. As i said it downloads the first file and then freezes.
If you run it from in the debug folder (You can delete the exe and then recompile if you prefer.. I know i like to be safe) You can see it just downloads the first file and stops.
You can see that as soon as the download of the first file finishes.. the foreach loop finishes causing the "Finished" Messagebox. But i have previously tested.. the array of files has 2 files. a Document.rtf and Document2.rtf to download..and it knows this. But after first file it stops. I have no idea why. Could any of you please help?
|
|
|
|
|
hi all,
I am confusing the component and user control.What is the different between them?And if i would like to create a chart object(which include itself onpaint method), which is the best choice to do it, with component or user control?
any suggestion or related source will be appreciate.
Thanks in advance
regards
cocoonwls
|
|
|
|
|
A user control is reusable UI. A component is a dll, which could well have no UI at all.
A chart is obviously a user control.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi Christian Graus,
Thank for your answer I got it.
|
|
|
|
|
Christian Graus wrote: A component is a dll
Why does it have to be a .dll? Any small building block of a program could be deemed to be a component of the greater whole.
|
|
|
|
|
Well, it becomes semantic at that point. Is a single paint tool in my app a component ? Are all the classes that make my paint tools a component ? What makes them so ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I've always thought of a component in a mathematical sense (i.e components of fourier series etc).
Perhaps the computer science definition is different.
|
|
|
|
|
Christian gave you a good answer.
An easy example is a TextBox and a TimerextBox needs to be visible (have a UI) so if you were creating your own you would make it a UserControl and if you drag it onto a form it will display on the form.
A Timer never needs to be seen (no UI) so if you were creating your own you would make it a Component and if you drag it onto a form it will display its icon in the greyed area below your form in the designer.
Dave
|
|
|
|
|
Hi there friends.
I'm using VS2008. when I use text Box in my form CTRL+A isn't working.
How can we enable CTRL+A on text Box in C# form ?
Freshman
|
|
|
|
|
Haven't tried this[^] but it looks OK.
Dave
|
|
|
|
|
Thanks.
Is there a property in text box to enable this feature?
Freshman
|
|
|
|
|
No AFAIK. The easiest way would be to create a class that inherits from TextBox and give it this funtionality and use that each time instead when required.
Dave
|
|
|
|
|
Hello,
I'd like to create a program in C# that "fakes" mouse movement, clicks, and key presses. There's a game I love playing called GemCraft that lets you throw gem bombs on the screen. The procedure is to press "1", click and drag a gem where you want it, then let go and it explodes. The gems are always in the same place on the screen.
What I'd like to find is a way to script these actions, so that I can leave the mouse pointer where I want the bomb, and press a button on the keyboard, and it automatically drops a bomb at that location.
Is there a way to do this? Also, as a bonus question, is there a way to tell what color pixel is under the mouse?
Take care,
Michael Fritzius
|
|
|
|
|
pixel color is easy, you can do a screenshot and check the pixel where the mouse is. Getting a C# program to run keyboard macros in another program, is not likely to happen. Especially a game where you're not recording actions to windows as such.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I found something here
that uses keyboard and mouse hooks that shows how to intercept information from either the keyboard or mouse and do something to modify that information. Right now I have it so that when I press Enter, it moves the mouse down and to the right 50 units without my touching the mouse, and I don't even have to be focused on it.
So maybe it has to do with hooks of some kind, but it's possible, just kind of tricky. I can't figure out how to simulate a dragging operation.
Please take a look at the code and see if you can figure something out. It's got some kind of class that handles mouse motion, clicking and key presses, but nothing for dragging.
The screenshot idea is pretty good too--I believe I could incorporate that.
Thanks for your time,
Michael Fritzius
|
|
|
|
|
Hi All,
I'm just using these for the first time and I'm seeing some odd behaviour with the DatabaseExists() method. Basically, its always returning false even when the database exists. I'm basically testing a class in C# using my LINQ datacontext that ensures the required database for my application exists and is accessible before going on to use it. The class is:
internal static class DatabaseCreator
{
public static bool DirectoryExisted { get; private set; }
public static bool DirectoryCreated { get; private set; }
public static bool DatabaseExists { get; private set; }
public static bool DatabaseCreated { get; private set; }
public static string AppPath { get; private set; }
static SSdb _context;
static DatabaseCreator()
{
string temp = System.Reflection.Assembly.GetExecutingAssembly().Location;
AppPath = temp.Replace("DataLayer.dll", "");
}
public static void CheckDatabase()
{
_context = new SSdb(Properties.Settings.Default.SSDatabase);
if (!Directory.Exists(AppPath + "\\Database"))
{
DirectoryExisted = false;
Directory.CreateDirectory(AppPath + "\\Database");
DirectoryCreated = true;
DatabaseExists = false;
_context.CreateDatabase();
}
else
{
if (!_context.DatabaseExists())
{
_context.CreateDatabase();
}
}
}
}
All is working fine if the database isn't there, this class happily pops off and creates the correct shape database in the correct location. I've tested the database by connecting to it via Visual Studio with the expected connection string and password and so on, all is as it should be, the application can also carry on and use this database. The problem happens when I run this class when the database is already in existence, it tries to create it again and says that the file already exists.
Am I doing something obviously wrong here? Anyone else seen this sort of thing? I know the class needs some work before it is rock solid but this basic functionality should be ok as is.
What I've noticed is that this problem only occurs when the connection sting in use is as follows:
"Data Source=|DataDirectory|\\DataBase\\SSdb.sdf;Password=*********;Persist Security Info=True"
If I use a connection string replacing |DataDirectory| with the full path the DatabaseExists() method works as expected.
I'm not getting why CreateDatabase() can use the |DataDirectory| path ok, but DatabaseExists() cannot. Is this a bug in the framework or am I missing something regarding the use of these methods? I don't know if this makes any difference but I'm using SQL Compact 3.5.
Thanks in advance ...
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Well, I don't know what the problem is. Just some shots in the dark, what is SSdb class? What does the code look like for DatabaseExists() method on the SSdb class?
|
|
|
|
|
Hi,
SSdb is a DataContext class I made using SQLMetal, completely untweaked. I'll have to look at the code in DatabaseExists() method when I get home this evening, I don't have it in front of me right now.
Thanks,
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Just to tie up this thread. I've just received a reply to this query from Microsoft. Its a known bug with SQL Compact 3.5 whilst using the |DataDirectory| macro in the connection string ...
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Hi there.
I saw this string in Firefox's bookmark file :
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB
AAAAAQCAYAAAAf8/9hAAACJ0lEQVQ4jaXPoWvjUBzA8SdP7t
8oTFzgTKBmgYkFJhqYaOHEKBNHqBhh4njEjDBRysQRToxHRS
ETgzdRSEUhM4VEFFIxyMQgExMRExUTld8T6cptHWdOfODxe/
Dl9xPhLCec5egsIc00aaZJshidJaj1378IleUk85gii8gzRZ
5FFPOIYhGRznUdynLCLEd9QuhJhL4J3ruWxDcB6awO5n+FVF
a8I9yeQ+fYIuh3CX97qJFEXXQIexbRSBJdS+LxgDxTpJlGTR
OiebEh3NMOZrOB07Zwew7S7zDodwkvXdTVOrgOJZMB6Z0iGm
v0okAvCkQ4Ulj7BtaegX1g4LQtuic23lmnjl269WZDDzXy0D
cB6V1IPI2IFwUiuS+Q/QBr38A+MNcM7JaJ07bonNi4pw7yvL
s+00UNPeLJAD3ViPShJH0oiSYx9qGF+a2B0zKx9w3MZqMOH5
o4Rxad7xbdH/V2Qb9LcOEh8seSN3qiSaeKZBwSDQPCXxLpu3
SPHZwja7Oh07bxzlz0NEYUTyUfpfc58SzZmn9GlM8lH3k/Pe
wDe2v+GVFVFf9DLF8qzKaJEAIhBNKX7zR2GwghUFch5WOB2T
QxmybSlyxfKsRqWbFaVgS+xGqam/cbr+cSDRVW0yTwJcZuA6
/nIoRgtVwHqqeCnZ0vpHfxViDwJfGtxtqrA07LJr6NCHxZB3
itcFr25oTgXG5JxnVg+VzitGyMrw28UxdeK/4AmzjRL9vLQH
kAAAAASUVORK5CYII
I want to convert this string to image.
So I used this function , but an Exception occurred.
private Image Base64StringToImage(string base64ImageString)
{
byte[] b;
b = Convert.FromBase64String(base64ImageString);
MemoryStream ms = new System.IO.MemoryStream(b);
Image img = System.Drawing.Image.FromStream(ms);
return img;
}
Can you help me ?
Freshman
|
|
|
|
|
If you search the forums, you will find a thread about decoding base64 into an image from just a few days ago.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
You're missing some data. Ignoring the image / data stuff at the beginning, the rest of the string isn't long enough for base 64. I copied 20 characters from within the string, tagged it on the end and it displays ok.
|
|
|
|
|
Thanks friend.
hammerstein05 wrote: I copied 20 characters from within the string, tagged it on the end and it displays ok
Can you explain more ?
Freshman
|
|
|
|
|
data:image/png;base64,
if you get rid of that section at the beginning, you'll get an error along the lines of base64 string is of incorrect length. Well, the string is 312 characters, my understanding of this is that the string needs to be divisible by 64, so the next one up (removing characters would remove image data) would be 832 characters in length. So, I copied 20 characters from within the string and tagged them on the end. Admittedly, there would be incorrect image data, but it should still work. And it did. It displays an icon. It's probably the favicon.ico (Zine is the word on the icon)
That's how I got it working. Your code is pretty much correct.
|
|
|
|
|
Thanks , you're nice my friend.
Freshman
|
|
|
|