|
Check out http://www.codeproject.com/cs/database/CsvReader.asp
|
|
|
|
|
Hi All,
I just findout a special button control: AquaButton for .NET for my application. I think it's really cool.
http://www.econtechvn.com/en/aquabutton_detail.htm
But anyone tried this before?
I'm going to buy it and I need your comments.
Thanks,
NicVan
|
|
|
|
|
I'd like to point out that a single button is not going to improve the user interface. You must have a well thought out UI in the first place. In addition, the basic button is very easy to implement. Personally, I'm a graphics artist, and I don't find the other button shapes at all apealing.
Alex Korchemniy
|
|
|
|
|
|
hey guys, check out my new program at:
http://www.angelfire.com/hi5/mp3alarmclock/
If you guys have any questions, or want source code, please ask me!
D
|
|
|
|
|
Why not make an article from it?
<italic>Work hard, Work effectively.
|
|
|
|
|
I have a ton of picture boxes on a form, I made it so that if you click one it opens an open file dialog box and then opens the picture into the picture box, all seems fine. How do I code so that I can click on any picture box, and call a function that does that without making one for each picture box?
|
|
|
|
|
Tie all the click events to the same event handler.
---
b { font-weight: normal; }
|
|
|
|
|
That still would be horrilbe since I would have to make all picture boxes call that event. How do I make it not have to do that?
|
|
|
|
|
No, it's not horrible. I saw that you solved it that way after all.
---
b { font-weight: normal; }
|
|
|
|
|
I thought that I would have to make a differnet sub for each picture box, not that I could just have all click statements call into a sub.
|
|
|
|
|
Yes, as it was suggested, set the Click event of every picture box to the same handler. Once in the handler, popup the File Open dialog, and cast the sender (first parameter) to a picture box and set the image.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
|
Event handlers generaly have this signature control_event(object sender, EventArgs args) . You box sender to type of your control to use, e.g. object stg = (ComboBox)sender.SelectedItem; . If you subscribe more controls events to this handler, this way you will work with *that* control which raised the event.
David
|
|
|
|
|
So where do I put that code.
private void map11_Click(object sender, System.EventArgs e)
{
object snd = (ComboBox)cmbLevel.SelectedItem;
ChangePicture(snd);
}
private void cmbLevel_SelectedIndexChanged(object sender, System.EventArgs e)
{
szLevel = cmbLevel.Text;
}
private void ChangePicture(object sender, System.EventArgs e, object snd)
{
// Display an OpenFileDialog so the user can select a Cursor.
openMap.Filter = "GIF Files|*.gif";
openMap.Title = "Select a GIF File";
openMap.Multiselect = true;
// Show the Dialog.
// If the user clicked OK in the dialog and
// a .GIF file was selected, open it.
if (openMap.ShowDialog() == DialogResult.OK)
{
if(openMap.FileName != "")
{
// Assign the images to the picture box according to the selected level.
if (szLevel != "Bottom")
{
"""PICTURE BOX""".Image = Image.FromStream(openMap.OpenFile());
}
if (szLevel != "Top")
{
"""PICTURE BOX""".BackgroundImage = Image.FromStream(openMap.OpenFile());
}
}
}
|
|
|
|
|
ExpertComing wrote:
// Assign the images to the picture box according to the selected level.
if (szLevel != "Bottom")
{
"""PICTURE BOX""".Image = Image.FromStream(openMap.OpenFile());
}
if (szLevel != "Top")
{
"""PICTURE BOX""".BackgroundImage = Image.FromStream(openMap.OpenFile());
}
Here, you would replace "PICTURE BOX".Image with
((PictureBox) sender).Image</code).<br />
<br />
[EDIT: And in your <code>map11_Click event handler you would call ChangePicture(sender, e) and remove the third parameter you added.]
I hope this helps!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
ExpertComing wrote:
private void map11_Click(object sender, System.EventArgs e)
{
object snd = (ComboBox)cmbLevel.SelectedItem;
ChangePicture(snd);
}
Change the ChangePicture call to ChangePicture(sender, e); . BTW, what is in the combo box? You would bind every picture box to this handler, to this particular routine is called when the user clicks on *any* picture box.
ExpertComing wrote:
private void ChangePicture(object sender, System.EventArgs e, object snd)
{
// Display an OpenFileDialog so the user can select a Cursor.
Remove the third parameter in the definition so you have:
private void ChangePicture(object sender, System.EventArgs e) and see my other replies.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
The envent handler has two parameters: Object sender and EventArgs e . The first represents the object that raised the event. In this case, if you have several objects attached to the same event handler, you should use this parameter to distinguish.
Say you have 3 pictures boxes: pictureBox1 , pictureBox2 and pictureBox3 . You set the event handlers like this:
pictureBox1.Click += new EventHandler(pictureBox_Click);
pictureBox2.Click += new EventHandler(pictureBox_Click);
pictureBox3.Click += new EventHandler(pictureBox_Click); Then you only have one event handler:
private void pictureBox_Click(object sender, EventArgs e)
{
OpenFileDialog openDialog = new OpenFileDialog()
....
Image image = Image.FromFile(openDialog.FileName);
((PictureBox) sender).Image = image;
} I hope this explains it better.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
I got the coding part done before you replied again lol.
But now I get this error.
No overload for method 'ChangePicture' takes '0' arguments
|
|
|
|
|
GOT IT SWEET!
Thanks for the help.
|
|
|
|
|
You're welcome! great it worked!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
I have to fix a weird problem where a file needs to be moved using File.Move from a local directory to a network drive. The code that I'm trying to fix tries to pass either a network path or a mapped network drive path as a parameter to the Directory.Exists method but it fails. This code runs as a Windows service under XP.
I wrote my own exe to do the same thing but my code works. Why would an EXE work and not the service? Permissions to both drives are for Everyone.
Help.
|
|
|
|
|
Because the service in running under the Local System account (by default) which doesn't have rights to anything on the network. That's why the code works when YOU run it. It's running under your account.
You have to go into the Service Manager and change the account the service in running under to one with rights to the network.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hmmm... I already changed the service to run under my log on from the services' Properties Log On dialog and also changed the ownership of the mapped network drive to my name as well.
Is there another place where I need to change the log on?
|
|
|
|
|
Check on the two issues:
(*) The default path that gets formed for destination/source files. I think it would form as %system%, unless you prefix and qualify with AppDomain.CurrentDomain.BaseDirectory to get the proper path.
(*) RunAs of the EXE to run with an account with network access to the target resource.
Deepak Kumar Vasudevan
Personal Web: http://vdeepakkumar.netfirms.com/
I Blog At: http://deepak.blogdrive.com/
|
|
|
|