"save" A Function Inside An Object?

Jul 2, 2010

I was wondering if it's possible to "save" a function inside an object. something like the following code

sub Proc1(a as integer)
Console.WriteLine(a)
end sub

[Code].....

View 4 Replies


ADVERTISEMENT

Calling A Function / Assign Property Of An Object Inside An Array

Oct 5, 2010

So if I create an object test, and it has a property color. When I add this object to an array list I typically can access this using myarray(0).color but intellisense doesn't 'know' that I have a 'test' object inside the array. It would let me type myarray(0).whatever but would then crash if I made typo. It seems like I should be able to let it know what type of object I am trying to work with inside the arraylist. In code maybe something like this

[Code]....

View 1 Replies

In .net, If A Function Returns An Object, Is It Wrong To Just Use The Function, _as_ An Object

Apr 30, 2009

I've got a f(x) that returns a collection of user controls. .Net lets me just treat the f(x) name as the collection.

ex)
Private Function GetCcB() As Collection(Of Reports_ucColumn)
Dim cc As New Collection(Of Reports_ucColumn)
cc.Add(Me.ucColumn0)

[code].....

View 3 Replies

Call A Function From Inside Another And Suspend It Until The Called Function Is Finished

Jan 25, 2010

How can I call a function from inside another function and suspend the calling function until the called function is finished? I hope I can get some replies because I don't know how to ask the question and make sense:).

Anyway what I am trying to do in steps:

1. The user clicks button1 which triggers the click event.
2. From the click event I call a function
3. I then pop-up a form, that has instructions for the user to read.
4. After the user has read the form he will click the "Done" button and return to the calling function.

The problem is the the calling function continues to execute. I want to stop execution of the calling function until the users clicks the "Done" button on the instruction pop=up. I know I can use a msgbox but the instructions can be lengthly and does not look good in a msgbox.

I have tried the Call method with return in the "Done" button click but I can make that work. I also tried a goto statement but I can get that to work either. In the call statement I said call frmInstruction.show() and it got there but as I said the calling function continued to execute.

View 3 Replies

Wpf - Get The Object That Called (executed) .net Subroutine Inside Object?

May 27, 2010

I'm trying to extend my new WPF Touch Screen Keyboard (DLL) Library, to allow the user to get events from the Touch Screen Object. I'd like to be able to tell the Programmer what Object made the call (or executed the subroutine) that raised the event. Not dissimilar to the Sender as Object event parameters one gets when working with a System Object. Which begs the question, How do I get that information, if I don't ask for it?Is there a way to get this information from some call made in the subroutine about to raise the event?

View 2 Replies

Wpf - Get The Object That Called (executed) My Vb.net Subroutine Inside My Object?

Mar 31, 2012

I'm trying to extend my new WPF Touch Screen Keyboard (DLL) Library, to allow the user to get events from the Touch Screen Object. I'd like to be able to tell the Programmer what Object made the call (or executed the subroutine) that raised the event. Not dissimilar to the Sender as Object event parameters one gets when working with a System Object. Which begs the question, How do I get that information, if I don't ask for it? Is there a way to get this information from some call made in the subroutine about to raise the event? That would be nice, and a time saver for me.

View 1 Replies

Call A Tsql Function Inside A Function?

Mar 23, 2011

I arrive from years with Oracle plsql. Now I'm trying vb.net I created a function that return a char value, so written:

[Code]...

The question: I will create a function get_type(...) in vb.net that calls the tsql function written above... how can I call the tsql function [abc].[GET_PERSON_TYPE] in vb.net function get_type(...) function?

View 1 Replies

De-serialize Object Inside Object?

Dec 6, 2011

Is this possible?

Public Class Foo
public var as string
public sub Load(byval filename as string)

[Code]....

Up until now i've had a function that that returns Foo as Object (I'm trying to make the serialize / deserialize process general so I can just copy and paste and avoid explicitly setting each variable)

View 1 Replies

XML Serialization Of Object With Other Object Inside .net

Nov 29, 2010

I'm trying to XML-serialize a class the properties of which I use to format a document.Basically, it is a class for the document's header and another class for its rows. url...In this class diagram, the class I want to serialize is ExcelPrintCorte that inherits its methods from ExcelCabec and has a private member ExcelPrintDocumento (and a public method to get it).My purpose is to XML-serialize ExcelPrintCorte and save the inherited properties' values and also the properties' values of ExcelPrintDocumento. I followed many guides to XML-serialize an object but it saves nothing but: [code] So, what am I doing wrong? Or is what I'm trying to do not possible with XML serialization?

View 1 Replies

Make An Auto-save Function To Save Text In A Textbox?

Jun 18, 2009

I have been searching for the past hour to try and find a solution, but I have been unsuccessful. Also, I use VB 2008, so the Common Dialog Suggestion would not work.

View 23 Replies

Function - Pass Object Versus Reference Object In Parent?

Dec 1, 2011

I am working on a application that has quite a few functions involved and have been thinking of the following: If I have a function that has a few paramaters, is it more efficient to pass the objects to the function(Example 1) or reference the objects in the parent(Example 2)? Does it matter if the objects are large or not?

Example:

Class mainform
Public myGenericList As New List(Of String)
Public myDatarowArray() As DataRow

[Code].....

View 6 Replies

Split Function And Save Once Press The Save Button?

May 13, 2009

I am writing a program that involves the split Function. The user will enter A, B, C. I wrote a splic fuction code (below). I am not quite sure if it is right, I would also like to know how to write the code for that split function when the user preses the save button after entering there input.

Dim strInput As String 'input string
Dim strOutput() As Sting 'output string array
strInput = "A, B, C," 'user input
strOutput = Split(strInput, ",") 'splits the input string

View 3 Replies

Object Reference Not Set To An Instance Of An Object When Calling A Function

Jun 13, 2012

I call the function GetDataTable and when it gets to the return line, I get the error message: Object reference not set to an instance of an object.

Dim DB As New DBConn
Dim gd As New DataAccess.GetData
Dim DT As New DataTable

[Code].....

Updated. I'll see if I can update with the DataAccess.GetData code. I didn't originally put it in there because our shop use it all the time and have no issues with it.

View 1 Replies

Object Reference Not Set To An Instance Of An Object: VB Save Webpage?

Jun 15, 2010

Okay, so I'm using this code to save a webpage to a file:

Dim myWebClient As New System.Net.WebClient
myWebClient.DownloadFile(mainbrowser.url.tostring, _
"C:/currentpage.html")

[code].....

View 9 Replies

How To Call The DLL Function Inside Of A Dll

Oct 15, 2009

I am trying to create a little script program in VBScript and I want to call some of the functions in wtsapi32.dll, can anyone point me to some sample code on how to do this? I am assuming that the values like: WTS_EVENT_ALL, are just plain simple literal strings, and not pointer to a variable inside of wtsapi32.dll.

View 1 Replies

Add And Save The Textbox Inside Rtb?

Jun 18, 2009

i hav added a textbox inside rtb. Is there a way to save this textbox with rtb? and also print it

View 5 Replies

New Line Inside ToString Function

Sep 8, 2010

VB.NET 2008. How could I make a new line inside the ToString() Function that VB already have. How to do like a .WriteLine() but inside the ToString() function. In my case, this inside of a class of course. I don't know if you get me. All I want to do is to show a fraction in the normal way not using the slash(/). Showing the numerator on top of a line, and below it the denominator. This inside the VB pre-made ToString() function.

This is what I've tried;
Public Overrides Function ToString() As String
Return Me.numerator & "/" & Me.denominator
End Function
Output example: 2/3
But this is not what I want.

View 4 Replies

Possible To Return A Value That Is Not Declared Any Where Inside A Function?

Aug 15, 2009

Module Exercise
Private Function SetMembershipLevel()
Dim MemberAge

[code].....

View 6 Replies

Private Variables Inside Sub / Function?

Dec 18, 2009

I'm trying to make an application that calls a function to create a timer, but I cant use WithEvents or Private inside of a function or sub, Is there any way to do this?

View 5 Replies

Why Is The Name Of A Sub Routine Always Inside A Function Main()

Aug 2, 2009

Public Module Exercise
Private Function GetFullName$(MI As String, _
LastName As String, _
FirstName As String)

[code]....

I want to know why the name of a sub routine is being used inside a Function Main as i have highlighted in bold letter.Canīt it stay outside the Function Main() just close to the Sub Program.? Example: -

MsgBox("Hello " & FullName)
Return 0
End Function

[code]....

View 5 Replies

Record Inside Datagridview Does Not Save The Last Row?

Sep 21, 2011

I had following code:

If File.Exists("OTS_Username.txt") Then
File.Delete("OTS_Username.txt")
End If
Dim numCols As Integer = dgvExp.ColumnCount
Dim numRows As Integer = dgvExp.RowCount - 1

[Code]...

View 3 Replies

Save A Picture Box With Label Inside It?

Oct 8, 2011

I need to save a picture box to the hard disk with some text labels inside it.

View 6 Replies

Call An ASHX From Inside An ASPX.VB Function?

Feb 24, 2009

I need to get a value from an API I made with ASHX and normally it is called from javascript but I need to call it right in ASP.NET I figured this shouldn't be a problem but I'm not sure the syntax.

View 2 Replies

.net - ASP.NET (VB) - Close An Opened SQL Connection Inside Function?

Apr 11, 2012

Can anyone tell me how I close an opened SQL connection inside a Function?

I call a Select Function like this:

[Code]...

View 5 Replies

Altering Label Properties Inside Of A Function?

Oct 19, 2011

I'm trying to validate a form to be filled out by the users, and when the required section isn't filled, I increment an

ErrorCount += 1

variable to show that error(s) have occurred inside the program, I then also set an

ErrorArray()

to whatever the corresponding field number is, now I have 0-12 (13 fields). What I have also done is titled the labels that are associated with all of these fields to correspond with the ErrorArray() value that might be set, such as.

PatLabel0
PatLabel1 etc.

What I am trying to do is loop through the array contents, depending on which ErrorArray() values have been set, to go and set the corresponding fontcolor property of that label to red, to show that these now need to be filled out. This is what I have, but Visual Studio doesn't allow me to use the iteration through the loop as a reference to changing properties. Can anyone point me in the right direction to trying to figure this out, or at least tell me what else I could do. Just seems doing 20 if....then....else.... statements with 2 - 3 lines in each of them is redundant when 1 function line could do the same job. This is what I have.

for i = 0 to UBound(ErrorArray(12))
if(ErrorArray(i) = "*")then
PatLabel(i).forecolor = color.red

[code]....

that is basically all im looking for initially, but I can't do it.

View 1 Replies

Auto-updating Changes For Params Inside Function Possible?

Feb 24, 2012

I am currently facing an heavy struggle with architecturing my VB.Net app.To simplify, i'm using entries from XAML comboboxs, which all trigger OnChange the same routine which manages which Function(s) to use depending on which combobox triggered.The problem i'm facing is for example i have Function(ByVal A As String, ByVal B As Integer, ByVal C as Double, etc...), and it works if the routine calls explicitly for this function's result. But then if another combobox makes for example the variable B to change, then i have to add another "If sender= Then" check for this combobox and recall expicitly the function above (since B is one of its parameters)..In the end, my routine is loooooong like 24 checks with at least 4x duplicates of same functions..is there a simple way to make a Function autoexecute when one of its parameters change without having to be called explicitly by another routine ? (Like Excel formulas do when one of its references change)

View 12 Replies

Calculate Inside Regex.replace Function?

May 21, 2010

I am trying to perform calculations on Regex substrings. I would like to do something like (see $2)

lblResult.Text = reg_exp.Replace(txtInput.Text, "$1" & "$2" * 0.039 & "$3" & "$4" & "$5")

I can only do this like:

For Each RxMatch In reg_exp.Matches(Me.txtInput.Text)
Me.lblResult.Text = Me.lblResult.Text & _
RxMatch.Groups.Item(1).ToString & _
Math.Round(CDbl(RxMatch.Groups.Item(2).ToString) * 0.03937, 4) & _

[code]....

View 3 Replies

Function Inside Class File Cannot Be Seen By Compiler

Sep 22, 2011

I have written a function inside a class file which I added to my project in VB 2010 Express. Unfortunately, when trying to use this function in the main project, it cannot be seen by the compiler. The function is public. You can probably see from this that query that I don't know much about OO programming (I am assuming that the problem stems from something to do with this).

View 10 Replies

How To Call Function Inside Private Shared Sub

Jan 24, 2012

I have as sub that is triggered from the file system watcher when the new file is created in spec. directory.I need to call some function to do something with that file. [code]

View 6 Replies

Recursive Function Won't Exit Code Inside?

Apr 6, 2009

this its a function i made to make sure all the fields on a form are filled before to save to database but once it finds a object it should exit. but it just doesnt... i tried also with exit for and exit sub also tried puting the exit for just after the msgbox shows up but it wont exit, this its the last thing i did using a flag but it doesnt exit either.

[Code]...

View 10 Replies







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