|
|
yesu prakash wrote: .i dont want to know ur doubt
Funny, I don't want to know that you've committed to jobs you have no idea how to do. And yet, here you are....
yesu prakash wrote: .if u know u to develop voice chat reply me
Yes, I do. And, if you were to show any signs of doing some research and writing some code, when you asked specific questions, I'd be the first to help you.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
i am doing research now...how can u help me??
|
|
|
|
|
|
nobody know to explain about voice chat development.. thats y all giving useless reply...am i correct??... when i post any simple doubts.. i get sudden reply
|
|
|
|
|
nobody know to explain about voice chat development.. thats y all giving useless reply...am i correct??... when i post any simple doubts.. i get sudden reply
|
|
|
|
|
hi,
I have one problem can any one solve it.My aim is i want to view my .doc file which is saved in database using c# windows application.It must be in the same format when it was loaded .Please solve my problem.i tried very much but am not getting
Thanks
devinaren
|
|
|
|
|
devinaren, you made a statement as opposed to a queston. What is your question?
|
|
|
|
|
Your code is broken. If I could see it, I might be able to tell you where.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
private void ComboBox_KeyDown(object sender, KeyEventArgs e)
{
this.ComboBox.DroppedDown = true;
if (e.KeyCode == Keys.Up && this.ComboBox.SelectedIndex != 0)
{
this.ComboBox.SelectedIndex -= 1;
return;
}
if (e.KeyCode == Keys.Down && this.ComboBox.SelectedIndex != this.ComboBox.Items.Count - 1)
{
this.ComboBox.SelectedIndex += 1;
return;
}
this.ComboBox.SelectedItem = this.ComboBox.Text + "%";
}
Hello folks. I have this event set up to search/skip to the contents of a ComboBox by the text entered, however I want to make sure I can still use the up and down keys functionality... My problem is when I run this code in my project and press the up or down keys in the ComboBox my selection moves up or down two spaces rather than one. What am I missing?
Thanks in advance!
EDIT: Sorry, the code actually was slightly wrong due to my experimenting before posting. It's fixed how I meant it to be and the problem persists. The old code was as follows and has the same outcome:
private void ComboBox_KeyDown(object sender, KeyEventArgs e)
{
this.ComboBox.DroppedDown = true;
if (e.KeyCode == Keys.Up && this.ComboBox.SelectedIndex != 0)
{
this.ComboBox.SelectedIndex = this.ComboBox.SelectedIndex - 1;
return;
}
if (e.KeyCode == Keys.Down && this.ComboBox.SelectedIndex != this.ComboBox.Items.Count - 1)
{
this.ComboBox.SelectedIndex = this.ComboBox.SelectedIndex + 1;
return;
}
this.ComboBox.SelectedItem = this.ComboBox.Text + "%";
}
modified on Wednesday, February 25, 2009 6:10 PM
|
|
|
|
|
Well now I feel stupid. But I guess it's the learning process.
Turns out the built-in up/down key functionality was still running, so I essentially was repeating the process with redundant code. Removing the redundant code and leaving the return function to prevent the pseudo-search function on up/down works fine.
Thanks to anyone who read and considered this.
EDIT: Hahaha! Now I think I just realized this entire process was useless since the up/down keys don't act any differently without the extra code. I need more sleep, maybe? Someone put me out of my misery!
|
|
|
|
|
ps. index += 1 equals index = index + 1
|
|
|
|
|
Yeah, I know, which is why I was so confused by it.
|
|
|
|
|
Hi,
I am trying to transfer a txt file by loading it and saving it with a save file dialog.
SaveFileDialog saveDialog = new SaveFileDialog();
saveDialog.AddExtension = true;
saveDialog.FileName = "Checkers Game";
saveDialog.InitialDirectory = @"C:\Documents and Settings\Bar\My Documents\";
saveDialog.OverwritePrompt = true;
saveDialog.Title = "Save game";
saveDialog.ValidateNames = true;
saveDialog.ShowDialog();
if (saveDialog.FileName != "")
{
writer.Close();
file.Close();
FileStream fs = new FileStream(@"C:\Documents and Settings\Bar\My Documents\savegame.txt", FileMode.Open);
fs = (System.IO.FileStream)saveDialog.OpenFile();
}
but when i go to the saved file i get an empty file even though the text i loaded isn't empty.
Thanks
|
|
|
|
|
I don't see any statement where you actually write the text to the file. It looks like the statements in the 'if' clause are in the wrong order and incomplete.
|
|
|
|
|
the statements in the if clause close a different stream. The one which i want to open with the new stream. Google came up with
FileStream fs = new FileStream(@"C:\Documents and Settings\Bar\My Documents\savegame.txt", FileMode.Open);
for opening txt files.
|
|
|
|
|
What is wrong with File.Copy ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I don't know the destination file. he user desides where he wants to save it with the save dialog.
|
|
|
|
|
bar3000 wrote: I don't know the destination file
You are using the SaveFileDialog and you don't know the destination file name?
|
|
|
|
|
Hi,
your code seems completely wrong to me. Here are some of the problems:
- a SaveFileDialog is meant for the user to enter a new filename or choose an existing filename, or to cancel the intended operation. To do that correctly you should compare the return value of ShowDialog() against DialogResult.OK (you compare FileName with empty string, I doubt that is equivalent) and use the FileName value as the path of the output file (you don't use the value at all).
- (the part shown of) your code does not declare, create or use writer and file except for closing it, so at best something gets written somewhere else, and some (which?) file gets closed; anyway changing the state of writer and file should not be a side effect of the saveDialog.FileName != "" test, the writer and the file operation should only exist inside the code block following that test, and nowhere else.
- declaring a FileStream and opening a file inside the code block of the if statement, while not using that stream, does not make any sense. Once the if-block is done, the stream is out of scope, hence useless.
- if your code creates a FileDialog, it should also dispose of it; the using statement is the easiest way of doing it right.
I suggest you have a look at some CodeProject articles; a lot of them describe small applications that do load and save some data from and to a file, using OpenFileDialog and SaveFileDialog. Just use these as search terms in the CP search facility.
If you don't fully understand the FileDialog class, read its documentation; if you still feel uncomfortable, go buy and study an introductory book on the language of your choice. It will teach you the basics in a systematic way.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Sunday, June 12, 2011 8:38 AM
|
|
|
|
|
You can use this code at your own risk. I wrote it without being really awake.
using (SaveFileDialog saveDialog = new SaveFileDialog())
{
saveDialog.AddExtension = true;
saveDialog.FileName = "Checkers Game";
saveDialog.InitialDirectory = @"C:\Documents and Settings\Bar\My Documents\";
saveDialog.OverwritePrompt = true;
saveDialog.Title = "Save game";
saveDialog.ValidateNames = true;
if (saveDialog.ShowDialog() == DialogResult.OK)
{
File.Copy(@"C:\Documents and Settings\Bar\My Documents\savegame.txt", saveDialog.FileName, true);
}
}
|
|
|
|
|
Code looks good, however spoon feeding is bad.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Sunday, June 12, 2011 8:39 AM
|
|
|
|
|
The FileDilaog classes only allow the user to select a path, they don't actually do anything with files.
An easy way to actually write or open a file is using the Filename property of the OpenFileDialog and SaveFileDialog and save that in a string variable.
Then you use File.ReadAllText() method to read a file and File.WriteAllText() method to write the text to a file.
These work even without giving the user a possibility to specify the location or name of the file.
Both methods have a string parameter called path , that's where you can put the path you just got from the FileDialogs (or a fixed path).
modified on Thursday, February 26, 2009 8:11 AM
|
|
|
|
|
Hello new member here on The Code Project but I have used the site many times to find answers for my programing questions but so far have had no luck finding an answer for my current issue.
As the title very simply says I have a program that contains alot of RTF fields (20+) all of which are placed right next to each other vertically. Everything appears correctly except that between a couple of the RTF fields there is a gap (maybe 1px tall) were two of them meet running the length of the field.
Although this is a minor issue it is one that I must solve.
Any help would be greatly appreciated. If more information is needed please feel free to ask and thank you in advance.
|
|
|
|
|
You're placing them on a form using code, or..? You should be able to just re size the fields left of the gap or set the location of the fields on the right side 1 pixel to the left.
I don't know anything about using RTF fields in C#, so maybe I'm way off in my understanding?
|
|
|
|