4 Replies - 5113 Views - Last Post: 28 March 2011 - 09:23 PM Rate Topic: -----

#1 KrisVB  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 28-March 11

Need Help with VB6 problem ASAP please

Posted 28 March 2011 - 03:51 PM

Hi, I am trying to write a program of 2 questions

and I have done the first but I got stuck in the second with one tiny hiccup

the question is:

Write a program that requests a letter from the user via an Input Dialog Box, converts this letter to upper case, and gives its first position in the sentence "THE QUICK BROWN FOX JUMPS OVER A LAZY DOG". For example, if the user responds by typing b into the input dialog box, then the message "B first occurs in position 11" is displayed.

this is what i write as code so far,


Private Sub Command1_Click()

x = InputBox("Please type q", "assign 2")
y = "THE QUICK BROWN FOX JUMPS OVER A LAZY DOG"

Picture1.Print UCase(x) & " first occurs in position " & InStr(y, )

End Sub





I know it is an easy question but what i got stuck in is HOW TO COMPLETE THE CODE AFTER Instr as string2 SO I CAN INPUT ANY LETTER TO SEARCH FOR IN THE SENTENCE.

I know how to do it if the question was asking to input ONE letter, but to include all the letters ? I couldn't honestly do it

I hope anyone helps please ASAP

thanks in advance.

Is This A Good Question/Topic? 0
  • +

Replies To: Need Help with VB6 problem ASAP please

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9388
  • View blog
  • Posts: 35,246
  • Joined: 12-June 08

Re: Need Help with VB6 problem ASAP please

Posted 28 March 2011 - 06:06 PM

Perhaps put a loop that continues to ask for a letter input until an exit character is pressed?
Was This Post Helpful? 0
  • +
  • -

#3 KrisVB  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 28-March 11

Re: Need Help with VB6 problem ASAP please

Posted 28 March 2011 - 06:13 PM

Using the loop is not a choice unfortunately

They ask for a simple Code, and i still couldn't find it


thanks anyway
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9388
  • View blog
  • Posts: 35,246
  • Joined: 12-June 08

Re: Need Help with VB6 problem ASAP please

Posted 28 March 2011 - 06:14 PM

I guess use a lame goto...
Was This Post Helpful? 0
  • +
  • -

#5 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: Need Help with VB6 problem ASAP please

Posted 28 March 2011 - 09:23 PM

I don't understand your problem. The question IS asking to input one letter.

Your code isn't using InStr properly, as I believe you know. If you need help with that, then read this: http://www.aivosto.c...tips/instr.html , taking care to go over the examples, and you will see that for yourself.

This post has been edited by BobRodes: 28 March 2011 - 09:27 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1