|
My Current work around is initialize the array at 1 length and leave all values null. Then the application just outputs a blank record. Or skips on the other filters.
|
|
|
|
|
Is there a reason you are using a [dynamic] array?
The List<T> should to provide pretty much everything need to get the job done.
That said, you should initialise the array with zero members to start with, otherwise you ar elikely to get a world of pain when other developers come to use your code.
modified on Friday, September 18, 2009 10:40 AM
|
|
|
|
|
That is what I did was initilize it to 0th to resolve the issue.
The reason for not using List<t> is I am still learning how to use the List<t>? functionality. I Only used the Dynamic array for the first 2 arrays in the applicaiton and the others I have been using ArrayLists which is way better in managing then Dynamic Arrays.
But List<t> I have not grasped yet. As I want to be able to place multiple sub members to each entry and I have not figured it out yet. Though I am experimenting with it. I agree it would be the best way to handle what I am doing but A) I did not know List<t> when the applicaiton began development, and B) I have to learn somewhere.
|
|
|
|
|
Learning and using the generic list is going to be much easier than coding a fully functional dynamic array by hand. If you are already using arrays much of the syntax is the similar!
|
|
|
|
|
Why not use a Generic List?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
The entire program has already be written I am just tweaking the buggs out. In the future programs I plan to use List. But I still have a few things to work out.
|
|
|
|
|
Hi
i have a simple window form with a listbox that plays a highlighted mp3, works great if i add the mp3 to the project bin, however when i try and put a path in for mp3 for example f:\mp3\song.mp3 it says it "cant play file "
if i put a copy of the mp3 (song.mp3) in the project bin but leave the path as f:\mp3\song.mp3 then it plays fine
so i'm guessing it is defaulting to the project bin to get filename, what am i missing?
code:
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
dsAudioPlayer1.FileName = Path.GetFileName(listBox1.SelectedItem.ToString ());
kenny
|
|
|
|
|
kennyhibs wrote: Path.GetFileName
First guess is that you are only getting the filename and not the full path to the file. Try Path.GetFullPath instead.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
Thanks for that it was exactly what was wrong, i was trying to get the mp3 to play the filename but was taking out the full path to the file so it couldn't find it
kenny
|
|
|
|
|
Glad to help
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
GetFileName returns the name of the file: "song.mp3" - i.e. without the path. If you have this in the current directory (as in the case of the project directory) then it can find it. Give it the whole pathed file name and you should be fine. Try
if (File.Exists(listBox1.SelectedItem.ToString())
{
dsAudioPlayer1....
}
else
{
MessageBox.Show("Cannot find \"" + listBox1.SelectedItem.ToString() + "\"");
}
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Hi.
I have searched and searched and finally at the end of my tether!
My task is quite simple but I cannot find a solution. I would like to store various lists of Key Value pairs to use in my application as these may change in the future.
Can any one point me in the right direction?
The FoZ
|
|
|
|
|
Hi,
From the design point of view, get a list of all combo box from your applicatoin and save all values in database with combo name and values in one table. Later you can allow to change values by providing configuration screen to the user, that will update the this table.
|
|
|
|
|
Thanks for the reply. It is something that I have considered but it's one of those things where I would like to use the AppConfig file route as that means adding more tables to the already huge database (which is out of my control and will need permission for) and the data is very unlikely to change. It would be a nice hurdle to jump over in my project.
The FoZ
|
|
|
|
|
Hi,
It may be a stupid question But I want to know that is it possible to use IDTExtensibility interface in VSTO projects?
If YES,please give me an example..
Thanks
|
|
|
|
|
my application is windows based (C#.net)
i have two forms both containing a windows media player
i go to first form(Form 1) and start a file in media player now if i go to second form and start a file in media player there also , the media player in form 1 should stop
how will i achieve this??
i have tried all the methods but nothing have worked like
Test ts = new Test(); [First Form]
ts.axWindowsMediaPlayer1.Stop();
ts.axWindowsMediaPlayer1.settings.volume=0;
ts.axWindowsMediaPlayer1.Dispose();
ts.axWindowsMediaPlayer1.currentPlaylist.clear();
ts.axWindowsMediaPlayer1.close();[Error-com object that has been seperated from its underlying RCW cannot be used]
plzz help
|
|
|
|
|
See when you create another object of form1 from form2, it doesn't mean you will get running instance. You need to get instance of same form previously loaded. So from the startup method, create two objects of form1 and form2 and use it in both form instead of creating new object and this will work.
|
|
|
|
|
I have some trouble in implementing the linked list in C#.NET. Is there any specific link or samples available , which gives clear picture as how to implement the doubly linked list in C#.NET.
|
|
|
|
|
|
Why? Use List<T> and it's little cousins. It works, without you having to faff about.
If you must create it yourself, then what is the problem? It's not exactly difficult, just labourious and a re-invention of the wheel...
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Well, Griff, I think you mean LinkedList<T>, since a List<T> is just a dynamically-resized array.
LinkedList<T> might support his purposes, but it does have some weaknesses... It doesn't let you do some of the fancier things, like splitting a list into pieces, or connecting two lists together to make a larger one... These are things you can do if you implement your own.
Unless .NET has a class that does that, which I just haven't stumbled upon yet.
|
|
|
|
|
right.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Ian Shlasko wrote: I think you mean LinkedList<T>, since a List<T> is just a dynamically-resized array
POETS day disease, probably! (I'm just amazed I remembered to use < and > from the buttons - I normally forget and it all starts to fall apart...)
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
|
Hi,
I have the following string and i will pass the filename and then i want to get the corresponding path...
<br />
string url = @" --------------Boundary-00=_BLD1cvEPKmuNkgPvUNY3 Content-Type: text/plain; charset=utf-8; name=footer.txt Content-Disposition: attachment; filename=\""footer.txt\"" Content-Transfer-Encoding: base64 G:\test\Attach\test\footer.txt --------------Boundary-00=_BLD1cvEPKmuNkgPvUNY3-- ";<br />
<br />
Regex r = new Regex(@"[a-z]:\\([a-z1-9\.\s]+\\)+[a-z1-9\.\s]+\.\w",RegexOptions.IgnoreCase);<br />
<br />
string regString = r.Match(url).ToString();<br />
I am able to get the output as :
G:\test\Attach\test\footer.t
In the above url string there maybe a chance that there will be 2 or more attachment codes like the above in the same string. I want to get the path alone like G:\test\Attach\test\ by passing a filename along with extension.
I don't know how to do it? Can someone pls help me out.
Thanks,
Raja.
|
|
|
|