Click here to Skip to main content
15,896,912 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: How To Print the Contents of a datagridview Pin
Richard MacCutchan16-May-13 2:59
mveRichard MacCutchan16-May-13 2:59 
AnswerRe: How To Print the Contents of a datagridview Pin
Eddy Vluggen16-May-13 3:01
professionalEddy Vluggen16-May-13 3:01 
QuestionFinding Duplicate numbers Pin
CowlitzTroy13-May-13 21:29
CowlitzTroy13-May-13 21:29 
AnswerRe: Finding Duplicate numbers Pin
Dave Kreskowiak14-May-13 4:38
mveDave Kreskowiak14-May-13 4:38 
AnswerRe: Finding Duplicate numbers Pin
MicroVirus17-May-13 1:39
MicroVirus17-May-13 1:39 
GeneralRe: Finding Duplicate numbers Pin
Dave Kreskowiak17-May-13 2:19
mveDave Kreskowiak17-May-13 2:19 
QuestionLists of objects without losing class Intelli-sense Pin
Purge1t13-May-13 18:24
Purge1t13-May-13 18:24 
AnswerRe: Lists of objects without losing class Intelli-sense Pin
Dave Kreskowiak13-May-13 18:51
mveDave Kreskowiak13-May-13 18:51 
The method shows up.

In VB.NET, the default access modifier for a class method is Public. In C# it's private.

You'd be better served by not depending on the defaults but explicitly declaring your access levels. Also, your naming convention isn't exactly clean and understandable either. In your example, how do to tell the difference between a variable called blob and your class called blob?? It should look more like:
VB
Public Class BaseBlob

    Private _position As PointF

    Public Property Position
        Get
            Return _position
        End Get
        Set(value)
            _position = value
        End Set
    End Property

    Sub New()
        Position = PointF.Empty
    End Sub

End Class

VB
Public Class Blob
    Inherits BaseBlob

    Public Sub MoveRight(ByVal distance As Single)
         Position = New PointF(Position.X + distance, Position.y)
    End Sub
End Class

VB
Public Class Form1

    Private blob As New Blob
    Private blobs As New List(Of BaseBlob)

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

        blob.MoveRight(10)
        MsgBox(blob.Position.x)

        blobs.Add(blob)
        MsgBox(blobs(0).Position.x)

        blobs(0).MoveRight(10)
        MsgBox(blobs(0).Position.x)

    End Sub

End Class


You can't tell Intellisense to show all members from every class inheriting from a base class. It's not showing you the members of Blob because you told it the collection was a collection of BaseBlob, not Blob. Do you see a member on BaseBlob called MoveRight?? Nope. So it's not going to show any members that inherit from classes that inherit from BaseBlob because none of them are valid! MoveRight is not applicable to a collection member of blobs because you're are treating the objects in the collection as if they were BaseBlob object. It's telling you that if you try to use one of those members, the compile will fail!

GeneralRe: Lists of objects without losing class Intelli-sense Pin
Purge1t13-May-13 19:21
Purge1t13-May-13 19:21 
GeneralRe: Lists of objects without losing class Intelli-sense Pin
Dave Kreskowiak14-May-13 3:44
mveDave Kreskowiak14-May-13 3:44 
GeneralRe: Lists of objects without losing class Intelli-sense Pin
Purge1t14-May-13 11:55
Purge1t14-May-13 11:55 
GeneralRe: Lists of objects without losing class Intelli-sense Pin
Dave Kreskowiak14-May-13 13:33
mveDave Kreskowiak14-May-13 13:33 
QuestionTryParse String from InputBox to Integer Pin
Member 1004983713-May-13 16:06
Member 1004983713-May-13 16:06 
AnswerRe: TryParse String from InputBox to Integer Pin
PIEBALDconsult13-May-13 17:30
mvePIEBALDconsult13-May-13 17:30 
QuestionHow to get values from listview and display it to textbox using sql database ? Pin
Member 1001708312-May-13 4:58
professionalMember 1001708312-May-13 4:58 
AnswerRe: How to get values from listview and display it to textbox using sql database ? Pin
Eddy Vluggen13-May-13 7:23
professionalEddy Vluggen13-May-13 7:23 
QuestionTreeView Find Starting from Some Child Node Pin
treddie11-May-13 21:20
treddie11-May-13 21:20 
AnswerRe: TreeView Find Starting from Some Child Node Pin
Eddy Vluggen11-May-13 22:18
professionalEddy Vluggen11-May-13 22:18 
GeneralRe: TreeView Find Starting from Some Child Node Pin
treddie11-May-13 23:50
treddie11-May-13 23:50 
GeneralRe: TreeView Find Starting from Some Child Node Pin
Eddy Vluggen12-May-13 1:16
professionalEddy Vluggen12-May-13 1:16 
GeneralRe: TreeView Find Starting from Some Child Node Pin
treddie13-May-13 11:04
treddie13-May-13 11:04 
GeneralRe: TreeView Find Starting from Some Child Node Pin
TnTinMn13-May-13 15:13
TnTinMn13-May-13 15:13 
GeneralRe: TreeView Find Starting from Some Child Node Pin
treddie13-May-13 18:24
treddie13-May-13 18:24 
GeneralRe: TreeView Find Starting from Some Child Node Pin
Eddy Vluggen14-May-13 9:10
professionalEddy Vluggen14-May-13 9:10 
GeneralRe: TreeView Find Starting from Some Child Node Pin
treddie14-May-13 11:53
treddie14-May-13 11:53 

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.