Click here to Skip to main content
15,899,000 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Use binnary file instead MS Access Pin
DaveAuld15-Jun-11 9:23
professionalDaveAuld15-Jun-11 9:23 
GeneralRe: Use binnary file instead MS Access Pin
David Mujica16-Jun-11 7:57
David Mujica16-Jun-11 7:57 
GeneralRe: Use binnary file instead MS Access Pin
Аslam Iqbal16-Jun-11 8:48
professionalАslam Iqbal16-Jun-11 8:48 
GeneralRe: Use binnary file instead MS Access Pin
Thomas Krojer20-Jun-11 2:55
Thomas Krojer20-Jun-11 2:55 
Question[VB10] Don't allow access to Form properties from Class Pin
The Mighty Atom15-Jun-11 6:31
The Mighty Atom15-Jun-11 6:31 
AnswerRe: [VB10] Don't allow access to Form properties from Class Pin
Eddy Vluggen15-Jun-11 6:42
professionalEddy Vluggen15-Jun-11 6:42 
GeneralRe: [VB10] Don't allow access to Form properties from Class Pin
The Mighty Atom15-Jun-11 7:11
The Mighty Atom15-Jun-11 7:11 
AnswerRe: [VB10] Don't allow access to Form properties from Class Pin
Eddy Vluggen15-Jun-11 8:57
professionalEddy Vluggen15-Jun-11 8:57 
The Mighty Atom wrote:
Lol, you're Dutch too!

Yup Smile | :)

The Mighty Atom wrote:
Anyway, just to make sure i understand, i need to change

That makes the complete class "private"; you could do that if you wanted to hide the class entirely (hiding it in a public class, for example)

You'd want to hide a property, so you'll have to make that property private. That would look roughly like this;
VB
Private Property SomeColor As Color
  Get
    Return Me._someColor
  End Get
  Set
    Me._someColor = value
  End Set
End Property


Now, if you try to look for the "BackColor" propery, then it won't be there in your class. I'm guessing that it's a property that's coming from a control that you're inheriting (Form is a control, and it has a backcolor) In that case, you could try to "overwrite" it by creating your own readonly-property that Shadows the inherited property, and hide it using attributes like BrowsableAttribute and EditorBrowsableAttribute. Here's a complete example project, inheriting from a panel, but works the same when inheriting from a form;
VB.NET
Public Class Form1
    Private MyPanel As New MyPanelClass ' we create a new variable from our class
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        MyPanel.Parent = Me
        MyPanel.Dock = DockStyle.Fill
        MsgBox(MyPanel.BackColor.ToString) ' Exception, since MyPanel.BackColor returns Nothing
    End Sub
End Class
Public Class MyPanelClass
    Inherits Panel ' let's extend the panel

    <System.ComponentModel.BrowsableAttribute(False)> _
    <System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)> _
    Shadows ReadOnly Property BackColor
        Get
            Return Nothing
        End Get
    End Property
End Class

The new property effectively hides the old one that gets inherited from the Panel class. The BrowseAble attribute hides in the designer, the EditorBrowsable hides it from intellisense. It still compiles if you use the property (you can't cut remove it), but it's hidden and cannot be set anymore - and would only return "Nothing".
Suspicious | :suss:

AnswerRe: [VB10] Don't allow access to Form properties from Class Pin
Dave Kreskowiak15-Jun-11 8:13
mveDave Kreskowiak15-Jun-11 8:13 
GeneralRe: [VB10] Don't allow access to Form properties from Class Pin
The Mighty Atom15-Jun-11 8:22
The Mighty Atom15-Jun-11 8:22 
GeneralRe: [VB10] Don't allow access to Form properties from Class Pin
Dave Kreskowiak15-Jun-11 9:37
mveDave Kreskowiak15-Jun-11 9:37 
GeneralRe: [VB10] Don't allow access to Form properties from Class Pin
Eddy Vluggen15-Jun-11 9:10
professionalEddy Vluggen15-Jun-11 9:10 
GeneralRe: [VB10] Don't allow access to Form properties from Class Pin
Dave Kreskowiak15-Jun-11 9:39
mveDave Kreskowiak15-Jun-11 9:39 
GeneralRe: [VB10] Don't allow access to Form properties from Class Pin
The Mighty Atom15-Jun-11 11:47
The Mighty Atom15-Jun-11 11:47 
GeneralRe: [VB10] Don't allow access to Form properties from Class Pin
Dave Kreskowiak15-Jun-11 12:22
mveDave Kreskowiak15-Jun-11 12:22 
GeneralRe: [VB10] Don't allow access to Form properties from Class Pin
The Mighty Atom16-Jun-11 5:34
The Mighty Atom16-Jun-11 5:34 
GeneralRe: [VB10] Don't allow access to Form properties from Class Pin
Dave Kreskowiak16-Jun-11 6:17
mveDave Kreskowiak16-Jun-11 6:17 
GeneralRe: [VB10] Don't allow access to Form properties from Class Pin
The Mighty Atom16-Jun-11 6:39
The Mighty Atom16-Jun-11 6:39 
QuestionFormatting a masked Text box Pin
Central_IT15-Jun-11 5:33
Central_IT15-Jun-11 5:33 
AnswerRe: Formatting a masked Text box Pin
Simon_Whale15-Jun-11 5:38
Simon_Whale15-Jun-11 5:38 
QuestionHow to Select item from datagridviewcomboboxcell Pin
Member 796162413-Jun-11 11:16
Member 796162413-Jun-11 11:16 
QuestionSelect item from datagridviewcomboboxcell Pin
Member 796162413-Jun-11 11:08
Member 796162413-Jun-11 11:08 
AnswerRe: Select item from datagridviewcomboboxcell Pin
Dalek Dave13-Jun-11 11:41
professionalDalek Dave13-Jun-11 11:41 
GeneralRe: Select item from datagridviewcomboboxcell Pin
phil.o13-Jun-11 11:46
professionalphil.o13-Jun-11 11:46 
Questioncopy file in vb.net Pin
faravani8-Jun-11 23:06
faravani8-Jun-11 23:06 

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.