Click here to Skip to main content
15,887,335 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# - window logon events Pin
Dave Kreskowiak7-Jul-12 3:09
mveDave Kreskowiak7-Jul-12 3:09 
AnswerRe: C# - window logon events Pin
Sunil P V7-Jul-12 3:21
Sunil P V7-Jul-12 3:21 
Questionopen pdf files from my project Pin
shaghyegh6-Jul-12 21:34
shaghyegh6-Jul-12 21:34 
AnswerRe: open pdf files from my project Pin
Mycroft Holmes6-Jul-12 23:13
professionalMycroft Holmes6-Jul-12 23:13 
GeneralRe: open pdf files from my project Pin
Trak4Net9-Jul-12 8:07
Trak4Net9-Jul-12 8:07 
GeneralRe: open pdf files from my project Pin
Dhyanga9-Jul-12 10:27
Dhyanga9-Jul-12 10:27 
GeneralIndex Out of Range Pin
ASPnoob6-Jul-12 16:36
ASPnoob6-Jul-12 16:36 
GeneralRe: Index Out of Range Pin
ignrod6-Jul-12 17:28
ignrod6-Jul-12 17:28 
Difficult to know without all the source code. However, from your description, seems that variable i in function AddText is out of range. You should check that i is positive and less than list1.Length. Something like this

C#
//Function to add string dynamically in Class1
private List<string> list1 = new List<string>();

public void AddText(string myText) {
    if ((i < 0) || (i >= list1.Length)) {
        MessageBox.Show(String.Format("i is {0}. Should be between 0 and {1}", i, list1.Length));
        return;
    }
    if((list1[i] == "") && (k < 1)) {
        k = i;
        list1[i] = myText;
        k++;
    }
}


By the way, please mind the ampersand in line
C#
if((list1[i] == "") && (k < 1)) {

Also, if you are looping, shouldn't there be a loop somewhere? I can't see it.
GeneralRe: Index Out of Range Pin
ASPnoob6-Jul-12 17:39
ASPnoob6-Jul-12 17:39 
AnswerRe: Index Out of Range Pin
Abhinav S6-Jul-12 17:57
Abhinav S6-Jul-12 17:57 
GeneralRe: Index Out of Range Pin
Trak4Net9-Jul-12 8:18
Trak4Net9-Jul-12 8:18 
AnswerRe: Index Out of Range Pin
Abhinav S6-Jul-12 17:57
Abhinav S6-Jul-12 17:57 
GeneralRe: Index Out of Range Pin
Roger Wright6-Jul-12 20:03
professionalRoger Wright6-Jul-12 20:03 
GeneralRe: Index Out of Range Pin
Abhinav S6-Jul-12 23:02
Abhinav S6-Jul-12 23:02 
GeneralRe: Index Out of Range Pin
ASPnoob7-Jul-12 0:27
ASPnoob7-Jul-12 0:27 
GeneralRe: Index Out of Range Pin
Roger Wright7-Jul-12 6:52
professionalRoger Wright7-Jul-12 6:52 
GeneralRe: Index Out of Range Pin
Trak4Net9-Jul-12 22:11
Trak4Net9-Jul-12 22:11 
QuestionStatic IP? Pin
Midnight Ahri6-Jul-12 15:49
Midnight Ahri6-Jul-12 15:49 
AnswerRe: Static IP? Pin
PIEBALDconsult6-Jul-12 18:31
mvePIEBALDconsult6-Jul-12 18:31 
AnswerRe: Static IP? Pin
Midnight Ahri6-Jul-12 18:33
Midnight Ahri6-Jul-12 18:33 
AnswerRe: Static IP? Pin
SoMad6-Jul-12 19:59
professionalSoMad6-Jul-12 19:59 
GeneralRe: Static IP? Pin
Roger Wright6-Jul-12 20:59
professionalRoger Wright6-Jul-12 20:59 
GeneralRe: Static IP? Pin
SoMad7-Jul-12 16:31
professionalSoMad7-Jul-12 16:31 
GeneralRe: Static IP? Pin
Dave Kreskowiak7-Jul-12 2:47
mveDave Kreskowiak7-Jul-12 2:47 
GeneralRe: Static IP? Pin
SoMad7-Jul-12 16:28
professionalSoMad7-Jul-12 16:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.