|
Wow. I didn't see that post - just this version. Apparently NASA want somebody to write the software for the Mars missions. They are willing to go as high as $100.
|
|
|
|
|
Yea one of the guy deleted his original post, was gone fast as I clicked the "bad question" button/link/thingie.
Pete O'Hanlon wrote: Apparently NASA want somebody to write the software for the Mars missions. They are willing to go as high as $100.
So that is why they had incorrect conversions between meters and feet... Those lazy overpaid code monkeys were to blame!
-Spacix
All your skynet questions[ ^] belong to solved
I dislike the black-and-white voting system on questions/answers.
|
|
|
|
|
Well deserved 5 for you there sir.
|
|
|
|
|
What's up People. Thanks for these Boards, ... At times they seem like such a hastle, but these forums are really just the Best spot for help. With that said, Im A Complete Newbie in Programing. Im shooting towards C# because i believe XNA uses the same language. My goal: Design and Develop a simple game. Besides that, i have a small project i want to complete for my footsteps.
This is what im looking to do.
*Listen to music using the "Playing MP3s using MCI - guide i found from this site"
*type single words in an INPUT Field - Pressing Enter or 'Button' Drops the words into a visible container. 'called container A'
container A has 2 buttons on the bottom. 'giving user option to Save or Open list created by user INPUT
*button1 = SaveList "browse to save"
*button2 = openList "browse to open"
Later i would like to be able to ADD or REMOVE 1 or multiple words from Container A to Container B by using Highlight method and pressing the A or R buttons on the side of container A.
So, that wraps it up. Hope it makes scense, I have a GUI design ill post up if that would help. im looking to build this one step at a time.
Thanks.
Chris From Simi Valley
|
|
|
|
|
and your question is??
the "container" you described sound more like a 'List View Control' which adding the required method would be a simple matter of syntax.
Give it a try/shot at coding it and if you have problems ask away
-Spacix
All your skynet questions[ ^] belong to solved
I dislike the black-and-white voting system on questions/answers.
|
|
|
|
|
hokeesm0kes,
Am a bit confused. Are you just telling us what you want to do?, or asking how to do it?
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
My apologies, I was telling you what i wanted to do, and i guess asking how to do it at the same time.
1 thing at a time.
How do i tell the button to take the contents of the INPUT field and display them in the 'list view control'
Its simple i know =0 (
|
|
|
|
|
add a click event handler to the button and then cap the input box's text and insert it as a list view item with
this.listView1.Items.Add(new ListViewItem(this.inputBox1.Text));
-Spacix
All your skynet questions[ ^] belong to solved
I dislike the black-and-white voting system on questions/answers.
|
|
|
|
|
Awesome, ... Thanks.
When you say cap the input box's text, what does that mean ?
Does that mean i just give the input field the name of inputBox1.text ?
|
|
|
|
|
cap = capture
If the input box is named "inputBox1" then to grab the text inside it use inputBox1.Text which is a property of the input box control class that will return the text contained within it as a System.String object.
Same goes if you named your List view control "listView1" then to add the item would be listView1.Items.Add(new ListViewItem("string of the item contents"); that is if your listView1 was setup with one column of information...
-Spacix
All your skynet questions[ ^] belong to solved
I dislike the black-and-white voting system on questions/answers.
modified on Wednesday, May 21, 2008 5:17 PM
|
|
|
|
|
Great.
Thank you.
Im @ work, so i have to wait till i get home. Ill let you know what happens.
|
|
|
|
|
I was at work too, but I was eerrrmm "compiling"
-Spacix
All your skynet questions[ ^] belong to solved
I dislike the black-and-white voting system on questions/answers.
|
|
|
|
|
I have loaded an image to a custom control when the user click on custom control to delete, i am dispoing the control plus deleting that pic.jpg where it resides but Windows is throwing an error saying it is begin used by other process.
This is how i am deleting but crashing
FileInfo f = new (imagefilepath)
f.Delete()<-----Crashing on this line
Thanks for your help
|
|
|
|
|
What Exception are you getting?
Either f might be null , otherwise you may get any of the exceptions mentioned here[^]
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thanks for answering but my f isnot null.
The image/jpg is already in the folder and i am loading within my Picturebox Control and upon clicking on a Delete button I want to remove the control as well as its image from the sourcepath but i am getting this exception
The process cannot access the file C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\bin\Debug\myTempDire\mainFolder\sFderName\images\2.jpg' because it is being used by another process.
|
|
|
|
|
Post how you are loading the image into the image box, by guess is that you did it via a image from file call.
So you'd need to close the stream to the file before accessing it.
I'd change it to the following:
When you load the image into the image box instead of pointing the box at the image. Read the image file into memory and inject the contents into the image box. That way the image box doesn't have a file stream connected to the file.
-Spacix
All your skynet questions[ ^] belong to solved
I dislike the black-and-white voting system on questions/answers.
|
|
|
|
|
Thanks for replying, Could you please show me in your example. I would better understand it then.
I shall be thankful
|
|
|
|
|
string fileName = @"C:\myImage.jpg";
using (StreamReader fileReader = new StreamReader(fileName))
using (Stream Img = fileReader.BaseStream)
{
this.pictureBox1.Image = new System.Drawing.Bitmap(Img);
}
untested/use at own risk/not liable/blah blah...
-Spacix
All your skynet questions[ ^] belong to solved
I dislike the black-and-white voting system on questions/answers.
|
|
|
|
|
By any chance are you using Image.FromFile to load the image? If so, the file is locked until you dispose the image. You need to either, dispose of the image before you delete it or, use an alternative method for loading the image such as FromStream which does not lock the method.
|
|
|
|
|
hi guy, I am loading image in the picturebox control like this on form load event. but Still the file is gettting locked. I don't know where the problem is getting. Any help Thanks.
string sourceFile =imagefilepath;
using( Stream stream = File.Open( sourceFile, FileMode.Open,FileAccess.Read, FileShare.Read ) )
{
try
{
Image image = Image.FromStream( stream );
stream.Close();
stream.Dispose();
pictureBox1.Image = image;
}
catch( Exception ex )
{
MessageBox.Show("so ");
}
}
|
|
|
|
|
That code should not give you a sharing violation when trying to delete the file further on. If it does, first make sure nobody else is actually using the file or keeping it open (perhaps not your application at all - or another part of it). Try using filemon (google that) to see what happens.
Some thoughts, however:
1. Make sure the picture box isn't still holding a reference to your image when you dispose of it. Otherwise, you will crash (either with an exception or with strangeness - this will depend on the current mood of your GDI). Always set pictureBox1.Image to null before you call image.Dispose() .
2. You are calling stream.Dispose() even though you're in a using block for stream . Don't. The using block does that for you when you exit it - regardless of exceptions or whatever else may happen. That's the reason using blocks exist. Also note that stream will close itself when it gets disposed (unless you do it first), so the stream.Close() call can be dropped as well.
Later,
--
Peter
|
|
|
|
|
Hy there,my problem is this: I have an image in my project resources,and a control that has an Image property set to that image. At runtime,I want to know what image is in that property. So i say
if(image == Properties.Resources.img1)
do something
I know that that is the image in the property,so why isn't it working?
|
|
|
|
|
System.Drawing implements neither the == operator nor the Equals() Method. So therefore it inherits the Equals() implementation from Object which checks object references. And so it fails. Using the == operator on an image is rather absurd anyhow. If it's an issue, you'll have to implement your own Equals or == routines and check the pixels one at a time, or use the object references to your advantage.
Scott P
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.”
-Edsger Dijkstra
|
|
|
|
|
Any idea how to convert strings like "Tuesday 1st April 2008" to a DateTime.
I have tried DateTime.TryParse with different CultureInfo, without result
Kjetil
|
|
|
|
|