473,387 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Need help with a console application

I am new to VB and have a question. I am writing a console application that takes two strings, each entered by the user, and displays them to the screen like so:

Console.Out.WriteLine("The value of the the first string BEFORE swapping is '{0}' and the value of the second BEFORE swapping is '{1}'", firStr, secStr)

(firStr, secStr are my string values)

now my question is, i have to call a procedure that will swap the two strings and display them to the screen like so:

Console.Out.WriteLine("The value of the the first string AFTER swapping is '{0}' and the value of the second AFTER swapping is '{1}'", firStr, secStr)

I need help getting the procedure correct to swap the two strings, any suggestions?
I have got this so far:

Sub SwapStrings(ByRef fStr As String, ByRef sStr As String)

and all code I have tried thus farfor the swap will not work, can anyone help?
Oct 6 '06 #1
3 1187
radcaesar
759 Expert 512MB
http://msdn2.microsoft.com/en-us/library/s6938f28.aspx

;)
Oct 6 '06 #2
first declare the strings as a part of the class, that is to say, outside of any procedures.

So
___
Public Class ConsoleApplication

Dim firstString As String
Dim secondString As String
___

now for our swap strings method, we don't need to pass the values to it, it will use the ones that are members of this class;

Public Sub SwapStrings

Dim tempString As String;

tempString = firstString;
firstString = secondString;
secondString = tempString;

End Sub



**Sorry if the syntax is slightly incorrect, I'm a C# guy. But the concept is the same regardless of language.
Oct 6 '06 #3
Problem solved, thanks for the information anaphaxeon and radcaesar! I was making it way more difficult than it needed to be.
Oct 6 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: omission9 | last post by:
Any advice on the following would be much appreciated. I have thrown everything I have at it and am completely stumped. I apologize for the length, I have tried to be as succint as possible. I...
4
by: Leonardo Hyppolito | last post by:
Hello, I am trying to write a multithread program that simulates producers and consumers. My program can have many producers and many consumers (each in a separate thread). It has a storage...
8
by: Jack Addington | last post by:
I want to scroll through the alphabet in order to scroll some data to the closest name that starts with a letter. If the user hits the H button then it should scroll to the letter closest to H. ...
1
by: sjaak | last post by:
Hi, Im just starting out with C#, I try to make a console application where the user has to fill in temperature in celsius degrees and gets fahrenheit, my code sucks ; can anyone help me out with...
6
by: tony | last post by:
Hello! When you have windows forms you have the same possibility as when you have a Console application to use Console.Writeln to write whatever on the screen. Now to my question: Is it...
3
by: Geoff McElhanon | last post by:
I have been struggling with a security issue that occurs under .NET 2.0, but does not occur under .NET 1.1. Essentially I am trying to open up a performance counter on a remote server and monitor...
1
by: John Wright | last post by:
I am running a console application that connects to an Access database (8 million rows) and converts it to a text file and then cleans and compacts the database. When it runs I get the following...
12
by: Dilip | last post by:
Hi All I have a server based C# console application. This application must hide its console window when its launched out on the field. So I dutifully P/Invoke'd FindWindow/ShowWindow...
4
by: Claire Blair | last post by:
I am trying to write a VB6 (not VB.Net) application that has a console window that allows Python command to be typed at the prompt. The idea is so that, I can have full Python scripting from...
1
by: mary mathews | last post by:
Hi, I'm getting an exception while tried to retrive an outlook contact using asp.net in a console application. The exception is as follows: An unhandled exception of type...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.