Error:Cannot convert type string to int
-
Code: foreach(int strAlternative in Suggest(arrWords[iCurrentCount]))-->Error Line { lbSuggestions.Items.Add(new ListItem(strAlternative, strAlternative)); }
what are contents of arrWords? Is it a string array? If yes, 'strAlternative' is also string
rockram wrote:
foreach(int strAlternative in Suggest(arrWords[iCurrentCount]))
I've a confusion with the above line. Is arrWords a double dimension array?
EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.
-
what are contents of arrWords? Is it a string array? If yes, 'strAlternative' is also string
rockram wrote:
foreach(int strAlternative in Suggest(arrWords[iCurrentCount]))
I've a confusion with the above line. Is arrWords a double dimension array?
EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.
StrAlternative is an integer
Sutheesh Ramachandran Cybernet Software Systems, T Nagar, Chennai 17.
-
StrAlternative is an integer
Sutheesh Ramachandran Cybernet Software Systems, T Nagar, Chennai 17.
I meant, It should be a string
EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.
-
StrAlternative is an integer
Sutheesh Ramachandran Cybernet Software Systems, T Nagar, Chennai 17.
Hello sir Thanks for your reply Here is my code: using System; using System.IO; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; partial class SpellSuggest : System.Web.UI.Page { private string[] strDictArray; private bool boolDictionaryLoaded = false; private int intErrors = 0; protected void Page_Load(object sender, System.EventArgs e) { int iCurrentCount = 0; string[] arrWords; string strCompleteOriginal = ""; int iWordCount = 0; //string hfOriginalString.Value, hfCurrentCount.Value, hfErrors.Value, hfWordCount.Value; char[] chSplit ={ ' ' }; //string strAlternative = ""; int i = 0; string strText; strText = Request.QueryString["txtContent"]; strText = strText.Trim(); // If nothing to check, exit the procedure if (strText == "") { return; // TODO: might not be correct. Was : Exit Sub } else { // Get the string to check strCompleteOriginal = strText; } // First time the page is loaded if (!IsPostBack) { // Initialize current word index to zero iCurrentCount = 0; // Initialize total word count to zero iWordCount = 0; // Initialize total invalid word count to zero intErrors = 0; // Set value of hidden field containing complete original string to check hfOriginalString.Value = strCompleteOriginal; // Set value of hidden field containing current index hfCurrentCount.Value = "0"; // Split into an array of individual words arrWords = strCompleteOriginal.Split(chSplit); // Count total number of words iWordCount = arrWords.Length; // Set value of hidden field containing total number of words hfWordCount.Value = Convert.ToString(iWordCount); // Set value of hidden field containing total number of invalid words hfErrors.Value = "0"; } else { // Not the first time, split hidden field into an array of individual words arrWords = hfOriginalString.Value.Split(chSplit); // Get index for current word in the array iCurrentCount = Convert.ToInt32(hfCurrentCount.Value); // Get current number of
-
Code: foreach(int strAlternative in Suggest(arrWords[iCurrentCount]))-->Error Line { lbSuggestions.Items.Add(new ListItem(strAlternative, strAlternative)); }
rockram wrote:
Suggest(arrWords[iCurrentCount])
Your method might be returning a string.
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions