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


ADVERTISEMENT

Accessing A Public Shared Variable From A Different Class?

Jan 10, 2012

I currently have two forms, and I need to share the value of a variable in one of them.

I declared the variable to be 'Public Shared', and assigned a value to it. However,

when I inspect the value it appears as 'Nothing'. Here is the snippet:

Public Class A
Public Shared sVar As String = Nothing
Private Sub A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

[Code]....

View 4 Replies

Override A Public Shared Method In Derived Class?

Oct 8, 2010

Can we override a Public Shared method in derived class? If not why?

View 2 Replies

VS 2005 Place The OpenfileDialog In Public Class Or Module?

Jun 30, 2009

if it is possible to place the openfileDialog in public class or module? i tried to place it with this code, but it did not work.

Public Sub DisplayDataOnGrid(ByVal gridTable As DataGridView)
Dim filepath As String
Dim OpenExcelFile As New OpenFileDialog()

[Code]....

View 2 Replies

.net - When Run Code Analysis VS2010 Wants To Add Property Infront Of All Of Public Members (CA1051 : Microsoft.Design)

Jan 24, 2012

When running code analysis on my project, I receive the following message:

CA1051 : Microsoft.Design : Because field 'ClassName.VarName' is visible outside of its declaring type, change its accessibility to private and add a property, with the same accessibility as the field has currently, to provide access to it.

Public VarName As String to this:Public Property VarName As String

I don't understand why the Property keyword is so important in this particular case. Can anyone provide an explanation as to why changing this member to a Property makes a significant difference to code analysis?

View 4 Replies

[2005] SyncLock And Multithreading - Public Class Utilities With A Many Shared Functions

Feb 11, 2009

I am trying to get a handle on SyncLock and multithreading, but I am having some trouble wrapping my head around exactly how it should be implemented. I have a Public Class Utilities with a many Shared Functions. I want to make sure that each function can only be executed when there are no other concurrent calls to the same function. So If I have 2 functions, A and B in a Public Class Utilities, what is the syntax so that a function "locks" while it is being executed, preventing any subsequent calls until the "locking" thread has completed?

CODE

Public Class Utilities

Public Shared Function A (ByRef i As Integer) As Integer

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

I know I need to wrap the statements of execution in a SyncLock block, but I am unsure of the scope of the parameter used with SyncLock...is it private to the function, class, etc? Can the same object be used to lock both functions if they are independent?

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

Create Two Notepad Files: Module HelloWorld & Public Class Person?

Oct 6, 2009

i am working on the MSDN tutorials through virtual labs and am encountering a problem with the very first tutorial regarding consoles. I am required to create two notepad files: Module HelloWorld & Public Class Person which I have done without errors having triple checked them. When the files are created I compile the HelloWorld.vb file and a .exe is created

I follow the rest of the steps and encounter an error when i try to compile the Person.vb file using the line vbc Person.vb/t:library/out:HelloWorldLib.dll as i am getting the following errors:

vbc : Command line error BC2001 : file 'HelloWorld.vb/t:library/out:HelloWorldLib.dll' could not be found
vbc : Command line error BC2008 : no input sources specified

View 2 Replies

VB - How To Use Dll - Project Class Library, Named It MyFirstDll And Made A Public Shared Sub HelloDll

Apr 21, 2012

I am just testing how to use dll and after googling a lot, I made it work partially...Created new project Class Library, named it myFirstDll and made a Public Shared Sub helloDll to do something. Now since this is my first time, the dll is simply showing the input in a msgbox:

Public Shared Sub helloDll(ByVal msg As String)

If msg <> "" Then
MsgBox(msg, MsgBoxStyle.OkOnly, "WE HAVE SOME MSG")
Else
MsgBox(msg, MsgBoxStyle.OkOnly, "NO MSG")
End If

End Sub

After building the dll-file, I started a new project using normal windows forms, named it "useMyDll", I clicked Project -> Add Reference, and added my dll. The program file that I made needed a textbox and a button for using the dll:

Private Sub useDllButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles useDllButton1.Click
Dim msg As String = Nothing
msg = TextBox1.Text
myFirstDll.myFirstDLL.helloDll(msg) 'this will be in msgbox in dll-file
End Sub

And when running this I could write something in the textbox and a msgbox with that input would pop up. Really happy with that. My first attempt to make a dll and use it was very successful. Then I thought, what about running the dll from rundll32.exe? It would be handy to make a dll that could be run without my exe. After googling a long time, I tried to add a new button:

Private Sub useDllButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles useDllButton2.Click
'Now let us see if we can open it using rundll32.exe ?
Dim msg As String = Nothing
msg = TextBox1.Text

[CODE]...

Now the first button still works just fine, but the second button gives some error (translated to english would be) like "missing entry: helloDll" I also tried to open with command prompt, same result.

After googling again I read one place that you can't run a visual basic dll with rundll32.exe, so is this true? Or is there some way of doing it? I read one place that it works if you make the dll be "COM-Visible", but I don't really understand how to or what it means. I tried to open properties, clicked Assembly Information, and "Make assembly COM-Visible", but this doesn't change anything. Then I read somewhere that it has to be in a module to work. Could it be that I need to rewrite some codes and it would work, or would I have to start learning c++ in order to accomplish this?

View 13 Replies

.net - Why Can't Call Private Shared Methods From A Public Shared Method

Aug 25, 2011

I have a class like this:

[Code]...

It works, when I make getBar methods public, but I don't want to expose these unneccessarily. Why I can't call private shared methods from a public one in the same class is over my head. I'm using .net framework 4.0 in a web application.

View 1 Replies

Private Read/Write Access And Public Readonly Access For Variable In Class?

Jan 12, 2012

Is it possible to set a variable in my custom class for Private Read/Write access and Public Readonly access without creating Properties with Get and Set? In other words, from within my class I want full access and from my form I only want read access. Right now I declare my variable as either Private or Public to control Public read/write access. I tried googling my question a bit but I'm not sure what the correct terms even ar

View 5 Replies

IDE :: Inteliscence Vs2008 - Not Seeing All Public Members ?

Feb 27, 2009

I am noticing i am not seeing all public members when i should an example:

Imports System.DataImports System.Data.CommonImports System.Data.SqlClientImports System.Data.OdbcImports System.Data.OleDbImports System.Data.OracleClientImports System.Configuration Dim builder As New SqlConnectionStringBuilder (NOT SHOWING) With builder .InitialCatalog =

[CODE]....

View 2 Replies

Methods Access Level - Making Public For Only One Class

Mar 20, 2009

I have a class which has various methods that I need to make public to only 1 other class. Is this possible? I don't want to make them public for everybody, just that 1 class.

View 1 Replies

Asp.net - Public Shared Variable Shared Between Users?

Mar 30, 2012

I've taken over the maintenance of the website (ASP.NET VB) and on one particular page I noticed the below code

Inherits System.Web.UI.Page
Public Shared UserNumber As String
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init

[Code]....

My question is whether the variable UserNumber can be accessed or changed by any other user than the current one?

View 2 Replies

New Static Fields And Hiding The Public Inherited Members?

Feb 3, 2010

Curious situation:
public class MyTextBox : TextBox
{

[code].....

View 1 Replies

Imports System.Xml - Error Namespace Or Type Doesn't Contain Any Public Members Or Cannot Be Found?

May 2, 2010

I'm setting up a simple XML read-write demo (VB Winforms) in Visual Studio 2010 Premium (tried in both the RC and RTM) and added:

Imports System.Xml

Result: Error Namespace or type doesn't contain any public members or cannot be found...

VS 2008 equivalent example recognizes the Imports statement fine.I know this has to be me, but I'm stumped.

Note: I tried this with the app targeting both .Net 3.5 and 4.0. Same result.

View 4 Replies

Public Shared Variable Ref?

Jun 29, 2011

I have an arraylist in a user form (Mainform) that I would like to be able to share among multiple forms and edit the contents. Using the Public Shared method I have been able to view and even edit the arraylist, but it does not seem to be changing it back on the main form. I can give more detail if needed.

View 9 Replies

.net - C# Equivalent Of VB Public Module?

Aug 5, 2010

I'm converting a VB.net library to C# and having trouble finding the C# equivalent to a VB.Net Public Module.

In the same VB class is a With block. Any idea what the equivalent might be for that as well.

View 2 Replies

Public Variables Not Available In Module

Jan 17, 2011

I have a variable declared at Public on a form. But when I try to access it in a module I get an error that its not declared.

[code]...

View 15 Replies

Public Shared Function Continued?

Aug 6, 2009

I made the changes from this:

[code]...

to this:(the 'End Function' says "Function 'GetFolderPath' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used."

[code]...

View 4 Replies

Public Shared MyVariable As String?

Jun 21, 2011

Say I have an ASP solution with a Globals.vb file. Inside that file, I have this: Public Shared MyVariable As String Now say I publish this solution and make it available to Bob and Cindy.If Cindy sets (through the interface) MyVariable to 5, would Bob be able to read it? I hope not, I'm hoping this variable would be user-specific.

View 2 Replies

Update Function Of Each Module To Be Public

Nov 2, 2009

I have a situation where I have several VB.NET Modules in the same Logical-Module of a large application. I would like the update function of each module to be public, but I would like users to be forced to qualify the function call with the module name.

ModuleName.Update()
instead of
Update()
Is this possible?

View 2 Replies

Working With Form1 From A Public Module?

Jan 19, 2011

I have a public module from which I want to use Form1 components. How do I do that? For example:

Module Print_to_textbox1()

what goes here for me to display a message into a textbox1 on Form1?

End Module

View 2 Replies

Accessing Public Shared Function From Another Form

Mar 1, 2011

[Code]...

i have a function that i have in my data access class now i want to access it then declare and assign parameters and then insert data into database.

View 4 Replies

Accessing Variables From A Public Shared Subroutine?

Feb 15, 2009

I have created a public shared subroutine in a class file in asp.net 2 (vb.net) web site app_folder.The subroutine retrives some values from a sql database via an sql query and assigns the datareader field values to several variables The problem is I can't seem to assign the variables from the subroutine to the variables and textbox controls in the asp.net page I am calling the subroutine from. The textbox text value just appear blank.By the way, if I response.write the variables in the subroutine they appear populated by the sql data reader.

View 9 Replies

Public Shared SqlConnection - Used In Multiple Functions

Jan 29, 2010

I have an asp.net web app. It has a shared class, and I want to have the connection string the same through out the site. My string is in my web config, but I don't want to type this all over the place:

View 3 Replies

Call Public Function In Module From WebPage?

Jul 20, 2009

Im new in this forum. I just recently upgraded my Visual Studio 2003 to Visual Studio 2008.I have a web project which is working very well in Visual Studio 2003. But when Im trying to run the same project in Visual Studio 2008, Im getting a runtime error message.The error message is about a public function which is defined in a public module. When Im trying to call that function from different web pages of my project, the web pages are not recognising the public functions and asking me to

View 3 Replies

Public Module Updating Form Object?

Dec 1, 2009

I'm working on a project for my VB class at school. I am creating a form with several inputs and it calculates the total amount owed for a car sale. I have a text box for input of the TRADE IN VALUE of a car. the program is looking for a numeric input. If there is no trade in, how can i get this box to default to 0.00 so it doesnt error the program?

View 2 Replies

VS 2008 Using Public Readonly Variable In A Module

Nov 29, 2009

I have a public readonly variable in a module, but when I try to set it in my form load event for the first time I get 'ReadOnly' variable cannot be the target of an assignment. It is my understanding that a ReadOnly variable can only be set once and after that you would get an error when setting it.

View 2 Replies

Write A Public Module For Display Record SQL?

Apr 16, 2012

I wrote a public modules for Insert, Update, Delete for SQL but I want to write public module for show any record on For example

"Listview or ComboBox or DataGrideView" by one module I mean When I create a new Form in vb I don't want to write All Command for each form to show record

Public Sub ShowRecord(ByVal TabelName As String, ?)
If SqlCon.State = ConnectionState.Open Then SqlCon.Close()
Try

[code]....

How to Fill this Space marked by question Mark?

View 1 Replies







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