Click here to Skip to main content
15,902,938 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Please help with a fairly simple percentage calculation.... Pin
Ashfield29-Aug-08 8:51
Ashfield29-Aug-08 8:51 
GeneralRe: Please help with a fairly simple percentage calculation.... Pin
Joey Picerno29-Aug-08 9:18
Joey Picerno29-Aug-08 9:18 
QuestionPossible memory leak Pin
dBrong28-Aug-08 11:53
dBrong28-Aug-08 11:53 
AnswerRe: Possible memory leak Pin
Scott Dorman28-Aug-08 13:34
professionalScott Dorman28-Aug-08 13:34 
GeneralRe: Possible memory leak Pin
dBrong28-Aug-08 17:00
dBrong28-Aug-08 17:00 
GeneralRe: Possible memory leak Pin
Scott Dorman28-Aug-08 18:01
professionalScott Dorman28-Aug-08 18:01 
GeneralRe: Possible memory leak Pin
Guffa28-Aug-08 21:51
Guffa28-Aug-08 21:51 
QuestionClasses Pin
CodingYoshi28-Aug-08 11:25
CodingYoshi28-Aug-08 11:25 
Public Class Employee
Public Name As String = Nothing
Public Age As Integer = 0
End Class

Module Module1

Sub Main()
Dim emp1 As New Employee()
emp1.Name = "Calvin"
emp1.Age = 30
Console.WriteLine("Emp1: " & emp1.Name & ", " & emp1.Age)
Dim emp2 As New Employee()
emp2 = emp1
emp2.Name = "Bob"
emp2.Age = 40
Console.WriteLine("Emp1: " & emp1.Name & ", " & emp1.Age)
Console.WriteLine("Emp2: " & emp2.Name & ", " & emp2.Age)
Dim emp3 As Employee = emp1
emp3.Name = "Bryan"
emp3.Age = 50
Console.WriteLine("Emp1: " & emp1.Name & ", " & emp1.Age)
Console.WriteLine("Emp2: " & emp2.Name & ", " & emp2.Age)
Console.WriteLine("Emp3: " & emp3.Name & ", " & emp3.Age)
Console.Read()
End Sub

End Module

Here are the results when run:


Emp1: Calvin, 30
Emp1: Bob, 40
Emp2: Bob, 40
Emp1: Bryan, 50
Emp2: Bryna, 50
Emp3: Bryan, 50

My question is:
How can I copy Emp1 to Emp2 and then if I change the Emp2 only Emp2 is changed, Not Emp1.
AnswerRe: Classes Pin
Gideon Engelberth28-Aug-08 13:13
Gideon Engelberth28-Aug-08 13:13 
GeneralRe: Classes Pin
Scott Dorman28-Aug-08 13:35
professionalScott Dorman28-Aug-08 13:35 
GeneralRe: Classes Pin
Gideon Engelberth28-Aug-08 17:05
Gideon Engelberth28-Aug-08 17:05 
GeneralRe: Classes Pin
Scott Dorman28-Aug-08 17:51
professionalScott Dorman28-Aug-08 17:51 
AnswerRe: Classes [modified] Pin
Scott Dorman28-Aug-08 13:36
professionalScott Dorman28-Aug-08 13:36 
GeneralRe: Classes Pin
CodingYoshi29-Aug-08 3:17
CodingYoshi29-Aug-08 3:17 
AnswerRe: Classes Pin
Guffa29-Aug-08 4:28
Guffa29-Aug-08 4:28 
QuestionAutomatic printing with VB.Net. Pin
John Kh28-Aug-08 7:46
John Kh28-Aug-08 7:46 
AnswerRe: Automatic printing with VB.Net. Pin
paas28-Aug-08 8:53
paas28-Aug-08 8:53 
GeneralRe: Automatic printing with VB.Net. Pin
John Kh28-Aug-08 9:37
John Kh28-Aug-08 9:37 
GeneralRe: Automatic printing with VB.Net. Pin
paas29-Aug-08 1:25
paas29-Aug-08 1:25 
AnswerLow tech Automatic printing Pin
David Mujica28-Aug-08 8:57
David Mujica28-Aug-08 8:57 
AnswerRe: Automatic printing with VB.Net. Pin
compad1-Sep-08 22:20
compad1-Sep-08 22:20 
Questionhow to add parameters to a report via a textbox and a button Pin
IlseBrase28-Aug-08 6:51
IlseBrase28-Aug-08 6:51 
AnswerCode stub Pin
David Mujica28-Aug-08 7:13
David Mujica28-Aug-08 7:13 
Questionscan an image from the scanner device directly from the vb.net application Pin
krinaljariwala28-Aug-08 5:20
krinaljariwala28-Aug-08 5:20 
AnswerRe: scan an image from the scanner device directly from the vb.net application Pin
Manas Bhardwaj28-Aug-08 5:30
professionalManas Bhardwaj28-Aug-08 5:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.