Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Answer - > text -> answer

Hi, im totally new in programming and trying to do some easy progs so i get a hang of it... im stuck and don't know how to do this;

Code
Module Module1

    Sub Main()

  Console.WriteLine("Vad heter din mamma?")
  Dim mamma As String = Console.ReadLine()
  Console.WriteLine("Vad heter din pappa?")
  Dim pappa As String = Console.ReadLine()
  Console.WriteLine("Din mamma heter " & mamma, Console.WriteLine("och" & pappa)
  Console.WriteLine()
  Console.ReadLine()
    End Sub

End Module

My question is how can i make it work? so that mamma (answer) then i write some text then pappa (answer2) is coming on the same line? I know i can put the answer etc ->
text: Answer
text: Answer2

but as you can see i tried to get the answer in the same line, how do i do it? Thanks in advance! :p
You do not need the second console.writeline on that line:
Code
Console.WriteLine("Din mamma heter " & mamma & " och " & pappa)
Or neater:
Code
Console.WriteLine("Din mamma heter {0} och {1}", mamma, pappa)
(Nov 10, 2012 01:11 AM)carrot223 Wrote:  You do not need the second console.writeline on that line:
Code
Console.WriteLine("Din mamma heter " & mamma & " och " & pappa)
Or neater:
Code
Console.WriteLine("Din mamma heter {0} och {1}", mamma, pappa)

Yay! Damn thank you haha i kept trying i didn't get it to work.. now i get it :P
Even though the {0} is red as the text is, it does count the {-} as the dim value? learnt something new if so :)
Yes, that is correct, see example:

Code
dim name as string = "john"
dim age as string ="28"
console.writeline("{0} is {1} years old", name, age)
'output is : john is 28 years old
(Nov 10, 2012 01:39 AM)carrot223 Wrote:  Yes, that is correct, see example:

Code
dim name as string = "john"
dim age as string ="28"
console.writeline("{0} is {1} years old", name, age)
'output is : john is 28 years old

I see! thanks... I will probably ask alot more in this forum, hope noone gets angry! 😝


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by SubmarinerApr 20, 2012 05:47 AM 3 154 Apr 20, 2012 05:47 AM
Last Post: Submariner