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
Solved

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

Posted on 2006-10-30
4
176 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
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

791 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