.net - Public Enum With One Item In A Different Scope (Like Friend)

Nov 18, 2011

Is there a way to do something like this?

Public Enum CarMakes
Honda
BMW
Mazda
Friend Yugo
End Enum

I need to expose the the Enum to Public except for one of the items I just want to be available from inside the assembly.

View 1 Replies


ADVERTISEMENT

Change The Scope Of A Designer-Created WPF User Control From Public To Friend?

Nov 27, 2010

I'm using VB.Net. I have a WPF User Control called "NavigationPanel" which I created with the Designer. By default, its scope is Public. When I change its scope to Friend in the file NavigationPanel.xaml.vb, I recieve the following error:

[Code]....

View 1 Replies

Can't Make Difference Between Public Class And Private Class And Friend And Protected Friend Class

May 15, 2009

I can't make difference between public class and private class and friend and protected friend class.

View 1 Replies

.net - "Public Friend" Versus "Friend Friend"?

Apr 21, 2011

I've been reading about access modifiers in VB.Net lately, and there is something that I can't really understand: How do elements in a Class (or Module) inherit the modifiers of their enclosing block?For example, suppose you have a Friend class Bla in an assembly, with a public method Foo:

Friend Class Bla
Public Sub Foo
(...)
End Class

Does it behave differently than when Foo is set to Friend?

Friend Class Bla
Friend Sub Foo
(...)
End Class

View 1 Replies

Enum Item - Protected Name - Statement Cannot Appear Within An Enum Body

Mar 25, 2011

I'm trying to declare an enumeration and one of the names I'd like to use for an item is not usable apparently. Where I am declaring 'STEP = 3', I get this error message in visual studio: "Statement cannot appear within an Enum body. End of statement expected." Is it possible to use STEP as an item name somehow? [Code]

View 4 Replies

Winforms - Friend Vs. Public For .net Forms?

Jan 19, 2010

Is it better to use friend or public forms in vb.net? What are the advantages of each?I notice when you import a vb6 project, the forms come in as friend, but when you add a new form in vb.net it is public. I have not seen any difference in the way they work, though, so I must be missing something.

View 3 Replies

[2005] Working Of Friend Class With Public Methods?

Feb 27, 2009

I understand how the class modifiers work like public, private, protected, friend and protect friend. They are pretty straight forward. However my question is, if I have a class is marked as friend, what should the properties and methods be marked as? Friend or public? Does it matter? I just want my classes at the lowest exposure level that will let my program work properly and that is friend. If I understand correctly, the public properties of a friend class are available to all members of the assembly. Wouldn't that be the same access level if the properties were all friend properties?The reason that I ask is that using the autocomplete feature to make new properties (type property and hit tab) it creates the new properties with the public attribute.

View 4 Replies

Public Function With Form Scope?

May 17, 2012

I have a Function for checking the input in a textbox and only allowing Numeric & Backspace; everything works fine so far. My form is for financials and it has about 20 textboxes; they all receive Numeric only data; there is NO alpha data on the entire form required. Note in the snippet below that I don't even need a decimal point as well.

Is there a way to handle ALL textboxes on this form without having to place the Function call in each textbox KeyPress event. took a long (5 year) hiatus from developing VB6

Public Function TrapKey(ByVal KCode As String) As Boolean
If (KCode >= 48 And KCode <= 57) Or KCode = 8 Then
TrapKey = False

[Code].....

View 5 Replies

Public Variable Goe Out Of Scope In Private Sub?

Aug 23, 2009

I have a public variable which seems to be going out of scope. I am confused as it has been dimensioned as a public variable: Public xlCell as As Microsoft.Office.Interop.Excel.Range

I originally had all my code in the same module in the same project and it was wrapped within a For/Next Loop (Example 1). I decided to clean up my code and make it more modular (Example 2). All the code is still in the same module in the same project.

Upon doing so, my public variable is not recognized in any of the private subs that I have created. I keep getting the following error: Message="Object reference not set to an instance of an object." When I test the variable using ?IsNothing(xlCell) in the Main Sub I get False in the main sub. this tells me te variable is recognized. However as soon as the Call SelectCaseSub() is triggered, I get a True value for ?IsNothing(xlCell). Why is this? Shouldn't this variable be in scope regardless?

[Code]...

View 6 Replies

Keeping An Item In Scope?

Aug 31, 2010

I have been working on a VB app to edit an excel document. I want to keep my excel workbook in scope for the whole app.

For example here is how my program looks now

private sub
open workbook
end sub

private sub
reference workbook
end sub

I want a way to just call my workbook at the top and have all of my subs recognize it. I guess like a global variable or something.

[URL]

View 5 Replies

Create A Enum Or Enum Type Functionality Witch Return String (enum Returns Int) In .net

Dec 30, 2009

I have a URL lets say . some time i need to send HTTP and some time i need to send it to HTTPS for that i created a enum:

Private _protocol As Protocol

Enum Protocol
HTTP
HTTPS

[CODE]...

Now when i get value back from protocoltype it returns me integer value as enum do so tell me how to get string from enum or other substitute.

Dim targetUri As String = setting.protocolType & "://www.mysite.com"

View 1 Replies

Too Many Arguments To Public Function.add (item As Object) As Integer

Nov 10, 2011

I'm writing this program to determine deterioration after X amount of years and i keep getting that same error.ive tried redetermining and revaluing variables.

Public Class Form1
Dim Anldep As Double
Dim endval As Double

[code]....

View 7 Replies

ENum Names And Values Don't Match For Same ENum

Jan 2, 2012

RE - FilesystemRights Enum

This Code:

Dim FSRS As Type = GetType(FileSystemRights)
For Each fsr As String In [Enum].GetNames(FSRS)
TextBox1.AppendText(fsr.ToString & vbCrLf)
Next

View 3 Replies

Nullable Enum Verse Enum.None?

May 26, 2010

Which is better, using a nullable enum or adding the value None=0 to your enum list?Using nullables requires more code, but I kind of like it since it forces me to think about the possibility. Otherwise I'm liable to forget about the None enum and fail to account for it being a special case.

View 11 Replies

Search An Enum Value Inside Of An Enum?

Aug 23, 2011

I've tried the code below but it always returns nothing, It should enter

Protected Function GetTotalDebitAmount(ByRef roEntryDetailRecordBaseList As List(Of PPDEntryDetailRecord)) As String
Dim iTotal As Integer = 0

[Code]....

I need some one who evaluate the part below:

If CBool(Array.IndexOf([Enum].GetValues(GetType(TransactionCodes.Debits)), CInt(oEntryDetailRecord.TransactionCode)) > 0) Then

View 1 Replies

Reciept Printing - Form Which Consist - Item Code , Item Name , Item Price , Quantity Of Item

May 25, 2012

Regarding my college project. i'm working on a sales system . i have a form which consist of all the following information( item code , item name , item price , quantity of item ) which is display using a data grid . data input by user using text box and all this information will be stored in a database(sales database) i'm using ms access 2007. the grand total will be displayed in a text box . and amount paid will be input in a text box too , my major problem now is how to i create a reciept that will have all this information of the purcase. i have a reciept button . what the next step ? i dont have any idea how to get the reciept done.

Imports System.Data.OleDb

Public Class Form5
Dim con As New OleDbConnection

[CODE].......................

View 9 Replies

Asp.net - Access A Module Or A Public Class With Public Shared Members From Inline Vb Code <% .. %>?

Feb 10, 2011

I can access a module from code behind but not from the aspx page in inline VB code <% ... %>.

View 2 Replies

Declare A Public Param For Public Class Form1?

Apr 7, 2011

Imports System
Imports System.Threading
Imports System.ComponentModel[code]....

how to declare "smsport" on class smscomms as public so that it can be access in class form1 or button1_click event.

View 5 Replies

Declare A Public Variable And A Public Sub In An Aspx Webpage?

Aug 26, 2010

How do declare a public variable .aspx web page that can be used in all the pages within my web application?

View 3 Replies

.net - Friend WithEvents In VB Vs Private In C#

Dec 17, 2009

Who knows, why in vb.net WinForm projects the designer by default use the Friend WithEvents attributes and in C# - private ones.

By ex, in a form.designer.

.cs

private Label Label1;

.vb

Friend WithEvents Label1 as Label;

For WithEvents is more or less clear(for using Handles, apparently). But why Friend in VB and private in C#...

View 4 Replies

Declare A Class As Friend Of Another In VB?

Jun 30, 2009

I have class Aand BHow do i declare the class B as a friend of A?

View 4 Replies

Friend Modifier Not Working?

Aug 9, 2011

I have a Class with certain subs and functions declared as protected friends. From my understanding this should allow me to be able to access those subs and functions from anywhere in my project and yet it isn't working.

View 5 Replies

Simulate C++ Friend In C# And Program?

Dec 20, 2010

I can think of the following tricks:

Read only wrapper - like ReadOnlyCollection. The friend keeps the pointer to the modifiable object, while everyone else can access only the wrapper.Write delegate - the friend gives the constructor of the object a reference to a delegate as one of the parameters, the constructor fills it with an address to a private method that can be used to modify the object.Reflection - obviously a bad idea. Included for completeness.Multiple assemblies - put your friends together in a separate assembly and set your modifier methods internal.Expose the modifiable object, but add comments to modifier methods "This is an infrastructure method - don't call it!"Nested classes.[code]...

View 2 Replies

Use Friend Functions In Program?

Jun 1, 2010

As far as c/c++ is concerned ,friend functions are defined outside the classes and they are accessed without object name.But in vb.net how can i create friend functions like that ? Is the concept same here or its bit different than what was in c/c++ ?

View 11 Replies

Why Modifier Set To Friend In WinForms

Sep 14, 2010

When adding a new control to the designer in Winforms, the modifier on the control is set to Friend, but the default modifier is Private (right clicking the property and resetting the modifier). Is there a setting to set the modifier to default (Private)?

View 2 Replies

XML Serialize Friend Classes

Sep 23, 2009

I have a few classes (about 15 or so) in VB.net (2005) that I would like to be able to serialize to xml. Unfortunately they are labeled as friend classes and cannot be exposed outside of the assembly.The assembly is a dll that is a com interop plugin to a CAD system. I have set all of my classes as friends so that they are not exposed outside of the assembly for 3rd party use. I am wondering if I even need to do that. Setting the class to public would allow me to serialize things. However I don't want people linking to the assembly and using the classes.Should I even worry about other programs linking to my assembly? In fact I don't think there is a large chance of this happening. I just don't like the idea of having almost all of my classes with a public scope.Is there a way to make a friend class serializable?

View 2 Replies

Define A Constructor With A 'Friend' Modifier?

Aug 13, 2011

Can we define a constructor with 'Friend' modifier?

Friend Class Reader
Friend Sub New()
End Sub
End Class

View 1 Replies

VS 2008 Friend Has A Linking To A Database?

Oct 14, 2009

A friend at work is trying to write a piece of database software for an HND project and when adding his database file, he gets the below error message. I'm too much of a greenhorn to know what it means, can anyone make sense of it?

View 1 Replies

VS 2010 Facebook Friend Add Using Regex

Aug 27, 2011

facebook friend add using regex,how? [code]

View 1 Replies

Where Is The Friend Access Modifier Intended To Be Used

Mar 21, 2012

The only place I've seen the Friend modifier used is in the WinForms designer, as alluded to in Why is the modifier set to Friend in Winforms? and VB.NET: what does the 'friend' modifier do?. The Friend modifier appears to be an almost arbitrarily wide access level that was created to solve some historic architectural problem in VB, I just wonder if anyone has a meaningful continued use for it?

I have had some desires to expose methods only to a given namespace so as to roll the functionalities of a related collection of objects together and manage any of their non-thread-safe methods, while exposing the safe public methods to a wider scope in the same assembly. This access level does not exist yet Friend does. Possibly a corollary question then, is my usage of assemblies and namespaces at odds with what is intended?

[Code]...

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved