Solved

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

Posted on 2006-10-30
4
153 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
  • 2
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
VoteyDisciple earned 500 total points
Comment Utility
If Console.WriteLine() writes a line of text, what would read a line of text?
0
 

Author Comment

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

0
 

Author Comment

by:kishore_peddi
Comment Utility

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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Finding if Numbers are ranges 8 29
Performance enhancement 39 25
Merging PDFs with VB.NET 10 30
Code enhancement 5 12
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now