?
Solved

Need changes to console application example in VB.NET !!

Posted on 2006-10-30
4
Medium Priority
?
191 Views
Last Modified: 2010-04-23
CAN YOU MODIFY THE BELOW PROGRAM AND MAKE IT WORK ?
========================================


Module Module1

    Sub Main()
       
        'Reading values
         
        Console.WriteLine("Please input the following info !")
        Console.WriteLine()  

        Console.WriteLine("Enter your name : ")
        Dim x As String = Console.Read()              //WRONG
        Console.WriteLine("Enter your age : ")
        Dim y As Integer = Console.Read()           //WRONG
        Console.WriteLine("Enter your dob : ")
        Dim z As DateTime = Console.Read()       //WRONG
        Console.WriteLine("Enter your gender (M/F) : ")
        Dim a As ----------------------------           //Need this line of code

        Console.ReadLine()

        'Writing values
         
        Console.WriteLine("You have input the following info !")
        Console.WriteLine()  
     
        Console.WriteLine("Your name : " & x)
        Console.WriteLine("Your age : " & y)
        Console.WriteLine("Your dob : " & z)
        Console.WriteLine("Your gender (M/F) : & a)

        Console.ReadLine()

    End Sub

End Module
0
Comment
Question by:kishore_peddi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
VoteyDisciple earned 2000 total points
ID: 17838265
If Console.WriteLine() writes a line of text, what would read a line of text?
0
 

Author Comment

by:kishore_peddi
ID: 17838337
Can you please tell me how to declare a single character (Y/N) in VB.NET ?

0
 

Author Comment

by:kishore_peddi
ID: 17838403

Here is the code
==========

Module Module1

    Sub Main()

        'Reading values

        Console.WriteLine("Please input the following info !")
        Console.WriteLine()

        Console.Write("Enter your name : ")
        Dim x As String = CStr(Console.ReadLine())
        Console.Write("Enter your age : ")
        Dim y As Integer = CInt(Console.ReadLine())
        Console.Write("Enter your dob : ")
        Dim z As DateTime = CDate(Console.ReadLine())
        Console.Write("Enter your gender (M/F) : ")
        Dim a As Char = Console.ReadLine()

        'Need gap

        Console.WriteLine()

        'Writing values

        Console.WriteLine("You have input the following info !")
        Console.WriteLine()

        Console.WriteLine("Your name : " & x)
        Console.WriteLine("Your age : " & y)
        Console.WriteLine("Your dob : " & z)
        Console.WriteLine("Your gender (M/F) : " & a)

        Console.ReadLine()

    End Sub

End Module

How we can restrict the user input for name (let us say 10 characters) while he is typing at console window ? Appreciate your time and patience !!
0
 
LVL 19

Expert Comment

by:VoteyDisciple
ID: 17838407
I Googled "VB .NET datatypes" and found a number of pages that list types available in VB .NET.  

For that matter, what would you guess a type that stores a single character might be called?  Languages have some funky keywords, but most aren't THAT bad.  (-:
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question