|
Looking at the part that fails a bit closer..
int W = arrayOfLastNames[a].Length;
Console.WriteLine("{0}", W);
string[] temp = new string[arrayOfLastNames.Length];
for (int d = W - 1; d >= 0; d--)
{
int[] count = new int[50];
for (int i = 0; i < N; i++)
{
count[arrayOfLastNames[i][d] + 1]++;
W gets the length of the first item in arrayOfLastNames . In your for -loop you declare
for (int d = W - 1; d >= 0; d--)
An array in C# is zero based so the characters in the first name (of the last names) will be indexed from 0 to W - 1 which equals d , right? And you declare this in your for -loop but then you add + 1 again in the count[arrayOfLastNames[i][d] + 1] part causing the exception. You can't add 1 when d is the end of the array
modified on Thursday, September 3, 2009 11:12 AM
|
|
|
|
|
Actually I'm not the one who created the code. I just got it from the net so I just copied and pasted the things that would fit in the code...
|
|
|
|
|
Maybe you should take some time to go through code you 'just copy and paste', making sure you understand it...
|
|
|
|
|
Hi,
Please could any one tell me any free recommended library to skin UI in my WinForm application. I am developing application C#, .netFramework 3.5 and Visual studio 2008.
thanks,
Umrahi
If you have faith in the cause and
the means and in God, the hot
Sun will be cool for you.
|
|
|
|
|
Hi Everybody,
I would like to identify the event in a PC.
what ever the file i open, or changing from one window to another i need to get a event
in my C# application.
for example i have opened a IE application and Word Application if i change from IE to Word i should get an event.
How can i do it...
thanks in advance...
|
|
|
|
|
When it comes to the IO part, use the FileSystemWatcher class.
link[^]
|
|
|
|
|
Thanks for the reply.
it is not related with IO part.
My need is this when ever i change my IE Application(tab,minimize) the next focused application may be(word, excel, notepad ...) has to be killed.so i need to get the event first of all
if you have any idea please guide me
thanks
|
|
|
|
|
At runtime I need to modify the content of a ToolStripMenuItem.
I've made the changes (added and/or removed new items) but cannot figure out how to refresh or notify the MenuStrip to display the changes.
The menu changes are designed to persist between invocations of the program - and they show up properly when the program is closed and then re-executed. So, I know I've defined and added all of the items correctly - just can't get the changes to appear immediately after they're added.
Any ideas would be appreciated.
|
|
|
|
|
Did you try to manually update status bar through code? I am not sure about exact solution but in your case I think it should work.
|
|
|
|
|
Not sure what you mean by "update". Is there a method somewhere that performs an update of the MenuStrip or its items?
|
|
|
|
|
I'm tryed add, it's work! so, your App should work too, or you override sth.?
|
|
|
|
|
User Error!
Found the problem: was referencing the wrong instance of the form that contained he menustrip. When using the "real" form, everything works as it should.
Thanks for your help.
|
|
|
|
|
Hi,
My situation is this, I have 3 comboboxes (drop down list only, not editable), and If the user changes the value of one of the, the other two should change too.
I have used the SelectedIndexChanged Event successfully to update the other two comboboxes. But I have 2 issues with it, first: The code is not pretty, I have to repeat the same 3 times and secondly everytime a call is made to one combobox's SelectedIndexChanged event the other are called too because I update the indexes of those too in the first call. I know it's kind of hard to understand like this, so here's what I'm doing:
private void SubNetCountCombo_SelectedIndexChanged(System.Object sender, System.EventArgs e)
{
HostCountCombo.SelectedIndex = SubNetCountCombo.SelectedIndex;
newsubnetmaskcombo.SelectedIndex = SubNetCountCombo.SelectedIndex;
}
private void HostCountCombo_SelectedIndexChanged(object sender, System.EventArgs e)
{
SubNetCountCombo.SelectedIndex = HostCountCombo.SelectedIndex;
newsubnetmaskcombo.SelectedIndex = HostCountCombo.SelectedIndex;
}
private void newsubnetmaskcombo_SelectedIndexChanged(System.Object sender, System.EventArgs e)
{
SubNetCountCombo.SelectedIndex = newsubnetmaskcombo.SelectedIndex;
HostCountCombo.SelectedIndex = newsubnetmaskcombo.SelectedIndex;
}
I thought of using a bool variable as a switch, so that everytime I enter each of those events it turns true and when it goes to the other methods I use an if to check for that variable, if it's true I just get out. But it's still not pretty... So.. I'm not sure if there's a better way of accomplishing this..
Thanks!
|
|
|
|
|
If any selection will change the other two,. you'll get into an infinite loop, unless you set some sort of flag which will tell the event handler not to do anything. You can also put all of these into one event handler, and just have it check which control it is working with, and then set the other two.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
mmm.. As I said, any selection changes the other two, But no, I do not get into an infinite loop, It only repeats two times the events and then gets out, but you don't notice it. It's not like it slows down the program or anything.
And about the flag, that's what I said in the end of my comment, I used it, but I just don't like the way it works. I want to know if there's another way to accomplish this, without:
1. Having to use a flag.
2. Having to "repeat the instructions" as I'm doing in the excerpt I pasted here.
Thanks
|
|
|
|
|
Well, you've listed the only options. Either have one event for each, or one event that all three use, that's all there is. As for the flag, I'd have expected code that changes the selected item on the other two, to cause events to fire over and over. If that's not the case, then that's fine, you do not need a flag.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Ok.. Thanks.. That's all I wanted to know...
|
|
|
|
|
Hello,
I have a pdf file that has the whole help stuff in it. Based on the helpId(Which form the user has selected) I should display the correct help page.
Will this below code serve my purpose?
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "Guide.pdf";
startInfo.Verb = helpId;
System.Diagnostics.Process.Start(startInfo);
|
|
|
|
|
This is programming, it's not black magic. You can't just go around making stuff up and expect it to magically do what you want it to. Instead, you should use reference books and google to research the tools you are using.
No. Of course not. You've taken a random property and tried to make it magically do what you want. The verb is a predefined term like 'run' or 'print' that tells the process what to do. There is no way that I know of to make a PDF open on a specific page. You'd have to read the Acrobat documentation to see if it's possible to pass any parameters to Acrobat, to tell it what page to open. As you appear incapable of research, I'll tell you that Arguments is the property on ProcessStartInfo you use to pass an argument to a program. But, you need to find out for yourself if Acrobat will take an argument to do what you want it to.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
|
Abhishek Sur wrote: Atleast you need to open the PDF to your own viewer to have better control rather than opening in Acrobat Reader directly.
Those libraries are not cheap. What's the bet this guy is only interested in free solutions ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
|
I don't think you can do this using PDF files. If you can make your help files to a CHM file, work with Help.ShowHelp()[^] method by providing appropriate HelpNavigator value.
|
|
|
|
|
Hello,
I am using a MSAccess database date entered into the database are Medium date format ie. dd-mmm-yy format. But when the data is pulled from the db and shown into a datagrid, it's like mm/dd/yyyy hh:mm:ss. But I want only the medium date that is dd-mm-yy format(18-Aug-09). Please help.
Thanks in advance.
|
|
|
|
|
Any half decent database, stores a date as a date. That means, it does NOT store a string in any special format. It stores actual date information. So, in C#, you will end up with a DateTime object, instead of a string. And you can format that any way you like.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|