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


ADVERTISEMENT

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

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

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

Change The Default Modifier From Friend To Private In The Windows Forms Designer In VS 2008?

Jul 2, 2010

When I develop a Windows Forms app in Visual Studio using C#, every control that I add to my form is by default marked as private, which is what I want.

When using VB.NET, every control is by default marked as Friend (the equivalent of internal in C#), which is not what I want.

Can I just change this default? It seems like surely it's a setting somewhere.

View 2 Replies

C# - Access Modifier For Namespace?

May 22, 2012

Can a function or sub-routine be accessed by the same namespace with the access modifier of private?

Or does the access modifier need to be public or internal?

View 1 Replies

Change A Forms Access Modifier To Public?

Jun 11, 2010

i want to now how to change the access modifier of a form so that it is publiv ind=stead of friend.

View 2 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

Cant Use Better Qualifier As One Intended To Be Used Is A Plain ObjectStore Only

Jul 1, 2009

I have a solution in which I have included three projects, say X Y Z..Now one of the projects X refers to the namespaces A.B.ObjectStore and another namespace ObjectStore..Now when the ObjectStore namespace is used the compiler thinks it is A.B.objectStore.I cant use a better qualifier as the one intended to be used is a plain ObjectStore only.

View 1 Replies

Collision Detection Not Operating As Intended?

Apr 7, 2012

I'm designing a system to detect whether a projectile arc impacts a stationary square target. However, the detection is very limited and only seems to work if I use a while loop and a very large area, whereas if possible I'd prefer to animate it using a for loop and have the target somewhat smaller.Here's what I have at present:

Private Sub Timer2_Tick(sender As System.Object, e As System.EventArgs) Handles Timer2.Tick
If (Not errorState2) Then

[code].....

View 12 Replies

DataTable.getChanges() Not Working As Intended?

Mar 13, 2010

I'm currently working on a VB .net project that requires connection to a MySQL table. I've no problems loading data from MySQL table to a datagridview. I'm hoping to allow users to make changes to the datagridview and save those changes back to the MySQL table. Below is the Sub I wrote to save the changes. Before saving, it will check if there were any changes made to the datatable. However, datatable.getchanges() does not seem to detect changes made to datagridview (and hence, datatable; I "bound" the datatable to datagridview by means of bindingsource).

[Code]...

View 4 Replies

How To Display Data In Intended Format

May 3, 2011

I am using VB2010 and have a project set up with a DataGridView that is to display a table of data selected from a SQL 2008 database using a pre-defined dataset. My question is simply how to display the data in the intended format as seen in the attachment. I am attempting to merge rows in the first two columns of like-data. Addtionally, if that can be done, I would also like the user to be able to double-click on a name that would open an editing form.

View 5 Replies

Method Not Intended For Code Attribute?

Feb 6, 2012

I have a couple of shared methods in my app which are intended to be used with ObjectDataSource's (and other reflection based objects). They handle a lot of automatic parameter checking, filtering, etc. They are, however, all one time use methods (they rebuild everything on every call). It would be much better for someone writing code directly to call the instance methods so that all the filtering, etc, is stored between calls.Is there an attribute I can add to my methods to indicate this? The best would be if it would prevent the method from being called without reflection. Second best would be to issue a warning that the method is being used wrong.[code]

View 1 Replies

Class Modifier For Method Calculate()

Oct 15, 2009

I would like a answer to the following question: For instance:

You have a class called Main. This class created a object of another class called Math.
Class Math has a method called Calculate()
Class Main wants to call this method Calculate().

What kind of modifier should I use for the method Calculate()? I always used public but now I am not so sure... Friend seems to be working as well. What is the best way to do this?

View 8 Replies

How To Set A Control To Public Modifier With Code

Jun 16, 2012

My problem is that I have made a Tabbed WebBrowser in VB 10 I have a TabControl1 and the following code as webbrowser

CType(TabControl1.SelectedTab.Item(0),WebBrowser)
I want to control the browser from another form but it is Private and I need ti set it to public.

[code].....

View 5 Replies

.net - The Intended Purpose For <app Name>.exe.config File In A .NET Forms App?

Sep 21, 2010

I am currently reading up on documentation for a possible assignment I might be put on. In a design document they talk about the .exe.config file. They state that its only purpose is to store constants: "Also note that this file is meant to store constants only, it is not meant to write configuration values to (and the .NET 1.1. framework even prevents this by not offering classes/methods to do so). Therefore, configuration is written to XML files using a..."As far as I understand, this is not true. I don't know about .NET 1.1 preventing this, but I remember in my last project that I did write configuration values to that file (I saved GUI contents there). My project was a small prototype, so maybe I did it wrong, but I do not think so...So what is the intended purpose of this file?

View 3 Replies

Determine If The User Intended To Delete A File?

Jan 10, 2009

how i can able to determine if the user intended to delete a file. What im going to do is this application will be placed in a certain folder together with some files. And this program will determine if the user inteded to delete a file within the folder.

View 2 Replies

Loop Function - Iteration Not Working As Intended

Jan 18, 2012

I'm using a DO interation to loop a function I'm using to test for internet connectivity. The code is working fine, except that when one of the tests is satisfied the loop stops. I want this to continue in the background while the program is running. How can I get this to work?

Private Sub checkInternet()
Dim InetChecker As Boolean
InetChecker = CheckForInternetConnection()
Do While LabelCount.Text <> ""
Thread.Sleep(10)
[Code] .....

View 3 Replies

Getting State Of Modifier Keys Compact Framework?

May 4, 2009

How can I get the state of a modifier key using VB.NET on the Compact Framework, in this case Windows Mobile 6.1. I want to be able to determine if the following keys are pressed or locked:

Shift
CTRL
ALT

and for the Psion Teklogix machines

Orange
Blue

Although I may be able to work this out, if I can determine the others.I want to create my own on-screen indicator panel and want to poll the keys, not using events.

View 1 Replies

Variable For "Where" Modifier Of Update Routine For SqlCeCommand

Mar 8, 2011

with the following code:

[Code]....

I am looking for the correct configuration to allow a variable for the Where modifier of the SqlCeCommand(Update) routine. Within the database, T01 is a bigint field, and T02 and T03 are nvarchar fields. A literal coding such as Where T01=2 works fine, but an attempted variable configuration such as above produces the error The column name is not valid. [ Node name (if any) = ,Column name = T03Ctr ] at the ExecuteNonQuery() line.

View 2 Replies

Create A User Control Which Is Intended To Be Something Like A Table View?

Sep 26, 2010

I have to develop a small app for which I have to create a user control which is intended to be something like a Table View.On Form Load, the user should be asked about the number of rows of columns required on the form.Once the user sets the number of cells, each cell should have a button and a Text Box inside it (grouped together).

View 8 Replies

VS 2008 FileSystemWatcher And Windows Service Behaving Not As Intended

Oct 11, 2010

Ok for some reason I am having multiple problems with this code. The first issue is that one of the lines of code is seemingly ignored. Another issue is that some of the events are firing many times when they are only supposed to fire once. I have attached my code.

By the way, the string stored in AppSettings("WatchPath") in this case is C:Temp

Imports System.Configuration
Imports System.Diagnostics
Public Class Service1

[Code].....

View 3 Replies

Inserting Rows Into A Tableadapter With An Identity.true Modifier

Sep 10, 2010

I have a TableAdapter created where one column.identity is set to true with an autoincrement.My problem arise when trying to insert a row at run-time. The following is my code and the error message I am trying to over come.[code]"The column cannot be modified. [ Column name = RecordNumber ]" I am not trying to edit that column name. I set it to true identity so I don't have to keep track of record numbers that may be deleted later on. So basic question.How do I programatically add a row to table adapter that has one column.identity set to 'true'.

View 2 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

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

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

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







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