|
If you can write an article, and you think others can benefit from it, then go ahead!
My current favourite word is: PIE!
Good ol' pie, it's been a while.
|
|
|
|
|
Hi, if I have a URL for an image, whats the best way to load it into an image/bitmap class so that I can modify and save the image to the disk? I can load a web image into a picturebox using the loadAsynchronous method, but this seems a little in-elegant as I do not need to display the picture, just load it and modify it.
Thanks for any help.
|
|
|
|
|
You could use WebRequest[^] to download the image into a Bitmap class
WebRequest request = WebRequest.Create(URL);<br />
HttpWebResponse response = request.GetResponse() as HttpWebResponse;<br />
Bitmap bmp = new Bitmap(response.GetResponseStream());
only two letters away from being an asset
|
|
|
|
|
Usually when I'm joining a bunch of things to make a string, I'll just do like string a = pt.X.ToString() + ", " + pt.Y.ToString(); . I was just wondering if this was considered bad code or something, because any example I see where they are joining things together like this, they use something else besides this. Should I be using something else to join things like this? (Wow that was a lot of "this")
I wish I could drive...
|
|
|
|
|
I sometimes just use String.Format(....) ...
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Because strings are immutable if there are several concatenations involved it is better to use StringBuilder[^]
For small efforts I might consider String.Format for readability
only two letters away from being an asset
|
|
|
|
|
For a single statement like that, there is no better method.
The compiler turns that statement into:
string a = String.Concat(pt.X.ToString(), ", ", pt.Y.ToString());
This will allocate a string buffer with the correct size and copies the data from each string to it, so it causes a minimum of overhead.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
You should use a string builder
Christian Graus - Microsoft MVP - C++
"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 prefer string.Format for that.
There was a thread on this a few months back.
|
|
|
|
|
hello everybody,,
please I need help with how I can link my program written in Microsoft VS 2005 C# 2.0 with MS Access 2007. it is OK with MS Acces 2003 but with 2007 , I didn't find any solution for that. So anyone know the solution pleaaaaaaaaaaaaaaaaaase tell me immediatly......... thank u.
-- modified at 14:42 Sunday 25th November, 2007
|
|
|
|
|
Genius.Boy wrote: pleaaaaaaaaaaaaaaaaaase tell me immediatly.........
Calm down. That is not the way to ask for help around here. You might want to look at http://www.connectionstrings.com[^], if I recall, there are connection strings for Access 2007 there...
---modified
You also need to be a bit more descriptive about what problem you are having...
"I've seen more information on a frickin' sticky note!" - Dave Kreskowiak
|
|
|
|
|
Thanks alot Mr.Paul Conrad. I've just used it and it've worked correctly.
And I'm so sorry for my way in asking..... I realy respect all people......it just for fun. nothing more..
and thank u again and again..
|
|
|
|
|
No worries. Glad you got it to work. Bookmark the link I provided. I cannot begin to say how many times it has helped out
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
"Enable/Disable a button based on whether a checkbox has been checked or Not"
How can I do this.what is the procedure ?
anup
|
|
|
|
|
anupamwb wrote: what is the procedure ?
Here's the procedure:
- Visit MSDN
- Find the checkbox event to which you need to respond
- Determine the button's property that you need to change
- Write code to do that and stick in the event handler you discovered in step 2
/ravi
|
|
|
|
|
You'll want to set the Enabled property equal to the Checked property. Do this in an event handler for the checkbox when the checked value is changed.
"I've seen more information on a frickin' sticky note!" - Dave Kreskowiak
|
|
|
|
|
private void chkOptions_CheckedChanged(object sender, EventArgs e)
{
if (chkOptions.Checked == true)
button1.Enable = true;
else
button1.Enable = false;
}
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|
|
Hello. FOrgive me for being pushy on the subject of sounds and all, but is there a way to play a wave file that is in your solution explorer, EASILY? Thanks much in advance.
- I love D-flat!
|
|
|
|
|
Do any of these links help?/ravi
|
|
|
|
|
|
Thanks. I'll check them out now.
- I love D-flat!
|
|
|
|
|
No offense to what you already wrote, but isn't there a way to just make a .wav file play that's right in the solution explorer?
- I love D-flat!
|
|
|
|
|
Use the SoundPlayer class to play the file.
To access the file, you would write:
Properties.Resources.Wave01.wav
- assuming that the file is called Wave01.wav.
Kristian Sixhoej
"Failure is not an option" - Gene Kranz
|
|
|
|
|
Can you explain that last post some more; I'm still looking into soundplayer.
- I love D-flat!
|
|
|
|
|
Create a new instance of SoundPlayer:
System.Media.SoundPlayer MySoundPlayer = new SoundPlayer(); Then tell the SoundPlayer where to find the sound to play - in this case in your project resources:
MySoundPlayer.SoundLocation = Properties.Resources.Wave01.wav; Again, assuming that the wave file is named Wave01.wav.
Now, to play the file, you would do this:
MySoundPlayer.Play(); It's that easy. I recommend you read some more about the SoundPlayer class on the page Ravi posted a link to.
Kristian Sixhoej
"Failure is not an option" - Gene Kranz
|
|
|
|