Thanks for the help CK, but our class hasn't learned that code yet. lol, might be a little fishy if I used it in my program.
On Sep 24, 2:44 am, CK <[EMAIL PROTECTED]> wrote: > Firstly, that is a fantastic post, a perfect model for going > forward :) > > I would change a few things: > - firstly, rather than used a fixed size array of strings, use > System.Collections.Generic.List(TypeOf String) > - you now don't need a counter as this list will grow as you add each > word > - once all of the words have been added, you can then create a String > array by calling list.ToArray() > - You can use the static Array class to then create a reverse of your > array, eg. Dim reversedStrings() As String = Array.Reverse(strings) > - now you have two arrays of the same size, and so can loop thorugh > from 0 to array length minus 1 comparing each element in the array. > > Hope that helps, and sorry if any of the VB is wrong, I'm a C# guy > now.... > > On 23 Sep, 01:53, Jai <[EMAIL PROTECTED]> wrote: > > > Sorry if this posted twice. My daughter was playing on here when I > > turned away for a moment. > > > anyway, > > > I am writing a program that requests a sentence from the user one word > > at a time. Im then storing that word in an array and creating another > > array to reverse the sentence to see if it's a palindrome. > > > Public Class Palindrome > > Dim word(99), revWord(99) As String > > Dim counter As Integer 'counts words > > > Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As > > System.EventArgs) Handles btnAdd.Click > > 'add word to array > > word(counter) = txtWord.Text > > word(counter + 1) = txtWord.Text 'store word > > revWord(99 - counter) = word(counter) 'reverse elements > > counter += 1 > > End Sub > > > Private Sub btnCheck_Click(ByVal sender As System.Object, ByVal e > > As System.EventArgs) Handles btnCheck.Click > > > End Sub > > End Class > > > At this point Im not even sure that what I have is right. I dont see > > anything in my text book about comparing the elements, and I was > > unable to locate anything that helped on a basic google search. Do I > > have to loop this to keep adding the words entered into the word(99) > > array? And how would I compare the elements? what kind of procedures > > would you suggest? Mind you, This is advanced VB but it is not > > rediculously genius VB - and this in an online course, Im basically > > teaching myself with the help of peers like you. > > > Learning from my last post, Im here to learn not to argue. So please > > provide honest feedback and help, and if I didnt provide enough > > information for your help I'll be happy to let you know what you need > > to let me tap those brains of yours. THANKS! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://cm.megasolutions.net/forums/default.aspx -~----------~----~----~----~------~----~------~--~---
