C# - Method Accessible Only For The Outside?
Jun 28, 2011
Is it possible to have method have methods that are only callable externally and never callable internally?
Public Class Foo
Public Sub New()
Bar ' Should fail to compile as Bar is only accessible externally.'
End Class
Public External Sub Bar()
End Sub
End Class
View 5 Replies
ADVERTISEMENT
May 2, 2012
I am trying to convert this method to VB.NET but the online converters seem to make a mess of converting it. Can someone help:
C# original:
private IEnumerable<IGrouping<string, Reference>> FindReferencesWithTheSameShortNameButDiffererntFullNames(List<Reference> references)
{
[code]....
This errors on Where is not declared.I wouldn't have thought that the VB would not be that dis similar to the C# something like this:
Private Function FindReferencesWithTheSameShortNameButDiffererntFullNames(references As List(Of Reference)) As IEnumerable(Of IGrouping(Of String, Reference))
Return From reference In references
Group reference By reference.ReferencedAssembly.Name
[code]....
But I get: Definition of method referenceGroup is not accessible in this context.
View 3 Replies
Oct 19, 2010
Consider a MyForm class that contains a shadowed implementation of Show(). It also contains a CreateForm() method, which accepts an instance of the form and calls the shadowed sub:
[Code]....
View 3 Replies
Jul 27, 2010
I have a class library written in .Net that I would like to make available to VB6/VBA. What I tried did not work (obviously as I am asking this question). Here is what I did:
I Created a Class Library Project in Visual Studio 2010 Express and put the code in a Class Module.I opened the project properties and went to "Assembly Information" and checked "Make COM Visible". I went to "Advanced Compile" options and targeted .Net 2.0 (it's very simple code).I then removed all references expect for "System".I built the project (no warnings or errors) and copied the DLL out of the Bin folder into C:WindowsSystem32 I ran RegSvr32 to register the DLL and got the error: The module "MyDll.dll" was loaded but the entry-point DLLRegisterServer was not found. Make sure that "MyDll.dll is a valid DLL or OCX file and then try again.
View 3 Replies
Mar 12, 2010
Can i make my files to be unaccessible ? Its in my project but no one should be access or view it.
I mean like this, when i include a picture on my project MS.Net will make a new folder and name it My Resources, however if im going to make it a installer i need to include the my resources folder and when its installed in a computer a locate the folder location the user can see the pictures. Or in other sample i put a shockwave files in my project and thesame make my installer i need to include it and when its installed the user can play that shockwave file.
Is there a way where i can includeall the files that i wanted to include but make it unaccessible ?
View 16 Replies
Apr 22, 2010
I have a .exe program which has an embedded webservice running on port 800.I can access it locally via 127.0.0.1:800 just fine once the program is executed.I need to be able to send the service commands such as: * 127.0.0.1:800/dev * will get a list of devices attached to the program.
To my knowledge i need to forward port 800 on my router and then access my internet IP externally and I should be able to view/access this web service? am i correct?I am then wanting to create a PHP site which will send the desired commands back to the web-service running on my home pc.
View 1 Replies
Feb 28, 2010
I can't understand it..let me show you what i have first :
CODE:
and
CODE:
in ReportsOfficesEntities.vb:
CODE:
in BaseController.vb:
CODE:
And of course i added the references for both projects...
the error in BaseController.vb:
CODE:
I checked the whole code ..wondering if i am missing something ... nothing!
searched -->
1: maybe it is different a littel... i don't know
2:i am not sure if it is the same issue .. and it looks complicated to me..
note: i copy (Convert) that from C#.net project and it is working just fine in (C#.net)....!
View 1 Replies
Sep 12, 2009
I am trying to create a Class that is COM accessible.The problem I am having is that I cannot have any arguments in the class constructor Sub New.If I do than I get the error:"MSB3214 does not contain any types that can be registered for COM Interop"I can however afterwards use regasm ComDotNet.dll /tlb to create the tlb file.
However when I try to use the class in VB (after adding the reference) withDim test As ComDotNet.HelloDotNetSet test = New ComDotNet.HelloDotNet("Hello")I get an error.
If I remove the argument from Sub New() everything works fine.
Here is the code:
Code:Imports SystemImports System.Runtime.InteropServices
Public Interface IHelloDotNet Function GetAge() As Integer Sub SayHello()End Interface
[Code].......
View 2 Replies
Oct 23, 2010
As a learning experience I decided to try and implement the Shunting Yard Algorithm(string calculator) using OOP. It was successful for as far as I took it, but it had one flaw. In order to get the stack to be accessible from the operators I had to declare it as shared, which meant that all versions of the calculator shared one stack. This very short piece of code illustrates what I came up with and the "flaw". [code] How can I maintain the functionality of anOP.add1 without declaring "something" as shared?
View 9 Replies
Aug 12, 2009
I am doing a form (in vb.net) to store patients details. I have created that one is before 2 months. But right now when am trying to access the keyevents of textboxes and finds its not working. I have type a message in txtboxe's keydown, keypress and keyup but nothing is happening.
View 4 Replies
Jul 22, 2009
So what does this mean and how do I fix it? This message occurs if I place the New keyword in the line(s) below. If I remove it, i get an error at runtime saying I need to use New. What am I doing wrong? Code:
View 4 Replies
Jun 5, 2012
I've created a Http Server in VB.net.I've used the same "template", I guess you could say, for every project requiring an Http Server (quite a few recently).The problem is, this one I'm working with now requires that the computers on the LAN be able to connect to it. I can access the server directly from my computer though using: [code]Now I get an error every time when it tries to apply the prefixes: I've checked all the ports that are listening and 8002 is still open...
View 2 Replies
Mar 14, 2011
I have a VB.NET winforms solution, and would like to add the standard application exception handlers - Application.ThreadException and AppDomain.CurrentDomain.UnhandledException.I have the following code from MSDN
' Starts the application. '
<SecurityPermission(SecurityAction.Demand, Flags:=SecurityPermissionFlag.ControlAppDomain)> _
Public Shared Sub Main()
' Add the event handler for handling UI thread exceptions to the event. '
[code]....
How can I do it in VB.NET when I have no acces to the Sub Main() method?Is the case when "Enable Application Framework" of my solution properties is enabled (Sub Main is hidden)...
View 3 Replies
Apr 22, 2011
I took the liberty of creating a small slideshow showing my problem. view it here.
[URL]
As you can see, I start with an empty data table on the data source. I add information to a form and the data appears on other parts of the program through data bound list boxes and such. I can exit debugging mode and re-enter it, and the data is still available.
However, the data is NOT actually added to the data source's table.
If I modify the program at all, the data that is floating around disappears.
I do not understand why this is happening. Apparently I need some kind of code to tell it to write permanently but I have no idea how to go about it. This is something I've been fighting with for over a week. I cannot find any solid information about this online at all.
View 3 Replies
Jun 3, 2011
I use a gridview to query a DB and pull out results. The View then places the results in the view on the page. I then use a JS function to grab the data. Is there anyway can hide the gridview but still have the data on the page html side?
View 2 Replies
Apr 19, 2010
How do you make listbox accessible outside the form it is situated on?
View 3 Replies
Jun 8, 2011
i am developing a system for a business and would like the server to be one of the computers of the
organisation. My problem is that i don't know how to make the database accessible by the other
machines.
View 4 Replies
Oct 17, 2011
I want to build my own class. In it, I need to recreate a behavior we can see in DataTable and in some other places : accessing items by their name or by their index. How can I reproduce such a behavior. Here's what I mean :
'Here's one way to access the data
A = MyObj(0).value
'Here's the other way I would like to acces it
A = MyObj("Blablabla").value
How can I create my class so I can access items in an array (or list preferably) by it's index or an unique Name?
View 4 Replies
Dec 30, 2009
I have an issue with an app i am writing, i need to make a variable accessible to any module or class within the project but that cant be accessed outside of the app as it is accessing info the end user shouldn't have access to.
Ok, well a practice i have gotten into in the last few years is to declare a module on the same page as the main form and declare variables either friend or public (global variables). with my app public is not good so i tried Protected Friend but i cant use this within a module.
I tried placing it at the top of the main form but one of my classes can't access it, what would be the right way to do as expected. besides the main form i have 2 classes call them class1 and class2:- main interacts with both classes class1 accesses class2 class2 doesn't access class1
View 7 Replies
Oct 21, 2011
How do I make Variable eccessable to other forms in my app?
View 3 Replies
Jul 7, 2011
I'll try to explain this the simplest way I can, and I'll be happy to provide more elaboration as needed.
I've created a class, class playership, as part of a little strategy game for my own practice.
I've created the instance of a playership object in my main form using the following [code]...
I'm a little confused about this because I thought a public object or variable could be accessed from anywhere within a project.
View 4 Replies
May 15, 2009
Alright, first things first i'm sorta new to VB .NET i know VB6 like no one's business and am looking to upgrade but to do that i need to know how to be able to access form controls in modules, and i've done that, but i'm not sure if its right, here is my code frmMain:
Option Explicit On
Option Strict Off
Friend Class frmMain
[code].....
View 1 Replies
Oct 13, 2011
I have creatred a self hosted service with a proxy Service and Contrats
[Code]....
View 1 Replies
Jun 19, 2011
I'm developing an installer, and I would like to write to a folder accessible only to administrators. So, I need to display the UAC dialog and authenticate as an administrator. I know I could do this by having a separate executable that I run from the installer GUI, but I'd rather a solution that allows me to authenticate whenever I want in the application. Is this possible in .NET?
View 3 Replies
Jun 12, 2012
Error 4 Overload resolution failed because no accessible 'Where' can be called with these arguments:Extension method 'Public Function Where(predicate As System.Func(Of System.IO.FileInfo, Integer, Boolean)) As System.Collections.Generic.IEnumerable(Of System.IO.FileInfo)' defined in 'System.Linq.Enumerable': Nested function does not have a signature that is compatible with delegate 'System.Func(Of System.IO.FileInfo, Integer, Boolean)'.
Extension method 'Public Function Where(predicate As System.Func(Of System.IO.FileInfo, Boolean)) As System.Collections.Generic.IEnumerable(Of System.IO.FileInfo)' defined in 'System.Linq.Enumerable': 'HasFlag' is not a member of 'System.IO.FileAttributes'.
[code].....
View 11 Replies
Nov 26, 2010
I have an issue with FxCop and the warning: Abstract types should not have constructors.This is being displayed for a number of abstract classes (possibly all, I haven't checked). When I look most of them have no new method so I assume it's the complier adding a default one. So to remove it I add a private default constuctor (Private Sub New()), this then means all the inherting classes fail to build with the error: Class 'InheritingClass' has no accessible 'Sub New' and cannot be inherited.This seems odd as FxCop requests no public constructor, but when I remove it the build fails.
View 1 Replies
Oct 17, 2011
I'm just taking over an asp.net/vb site, and I'm definitely still learning. I'm receiving the following error:
BC30451: 'ByOwner' is not declared. It may be inaccessible due to its protection level.
I call a datasource with:
<asp:GridView ID="CaseCountByOwner" runat="server" AllowSorting="true" DataSourceID="ByOwner"
And here's what is in the codefile:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
HitMe.AddHit(Request.UserHostAddress, Request.UserAgent, Request.Url.ToString)
Dim user As String = Request.QueryString("user")
If user.Length() = 0 Then
[Code] .....
View 3 Replies
May 19, 2011
I know how to obtain the label of all drives connected to the computer running my application. But what about those which are shared and I have access to, but which are connected through a server? How do I get their volume labels? I need this because I am tracking files, and don't want to have multiple file entries for a single file which can happen if disks are moved around servers. I want my only assumption to be that the labels on each disk are different.
View 2 Replies
Nov 28, 2009
I have a RadioButtonList control which triggers a Sub LegalGaps on SelectedItemChanged event. This Sub creates and fills in an array the size of which depends on the User's choice of radiobutton options. The second Sub AvailableDays shall be able to read that array and highlight the days in the Calendar control accordingly on DayRender event. May I somehow declare an internally created variable a public one?
View 2 Replies
Feb 10, 2009
assume that i have two forms(form1 and form2)form1 code
Imports System.IO
Public Class Form1
Inherits System.Windows.Forms.Form
[Code]....
View 5 Replies