I have an Excel VBA function that takes a number of optional parameters, including an optional Range: Function DazBeta(A As Range, Z As Range, _ B As Integer, _ Optional Freq As Integer = 1, _ Optional c As Double = 0, _ Optional r As Range, _ Optional Pct As Boolean = True, _ Optional Label As Integer = 1)
I am translating to VB.NET, and it's the optional Range that is giving me grief because VB.NET does allow optional Ranges. Or rather, optional parameters must provide a default value. What is the recommended way to change the VB.NET function signature so that the code is callable from an Excel cell as a UDF? (The VB.NET implements a UDF, the assembly is registered as a COM server, and the Excel spreadsheet is told of this server and type library, allowing the VB.NET code to be called from an Excel spreadsheet cell.) I have other compilation problems, so I have not been able to explore this. I am thinking that accepting an optional Object (default value Nothing) might work and then I could cast the Object to a Range. Alternatively, if there were a default value that could be specified with an optional Range, that would work, too.
VB has a function InputBox() that will prompt the user to enter a single value, then click OK. Is there a parallel functionality in ASP.NET, that will get the browser to pop up some kind of input box to return a single value? If not, how do you recommend I achieve this effect?
I have VBA as a namespace in the vb6 code and i would like to know if there is a way of making .net know what there is, is there a specific application namespace? I have been guessing but haven't had any luck (the beauty of the help boxes, if only i knew more of the language)
If you're not living on the edge, you're taking up too much room
In Access if a query were to compute the sum of different fields where there is a likelihood of one or more fields being NULL, you use something like NZ. Is there any equivalent Function for handling NULLs in VB .NET?
I'm use the code below to retrieve the SUM of the column "BudgetAmt" from my DB but get InvalidCast Exception was unhandled error because the BudgetAmt and/or AllocationPersonnel holds no data:
Dim strSbCode As String = cboSubSubOrg.SelectedValue.ToString Dim budgetYr As Integer = CInt(cboBudgetYr.Text) personBudget = CDec(transDetailsDT.Compute("SUM(BudgetAmt)", "FundSource = '02101' AND DataSource = 3" _
I've just begun using VB2008 Express. As practice, I'm trying to create a simple program that allows users to practice their basic arithmetic skills. I've just run into one hiccup.
I have a procedure that generates random numbers for the program to spit out as text that the user will then do arithmetic on. I'm trying to create a loop that checks, in the case that a radio button selecting division practice, that the potential quotient [code]...
As a non .net programmer I'm looking for the .net equivalent of the old vb function left(string, length). It was lazy in that it worked for any length string. As expected, left("foobar", 3) = "foo" while, most helpfully, left("f", 3) = "f".
In .net string.Substring(index, length) throws exceptions for everything out of range. In Java I always had the Apache-Commons lang.StringUtils handy. In Google I don't get very far searching for string functions.
Edit:@Noldorin - My first encounter, although it took me several seconds to do the same in c#:
Note the static class and method as well as the this keyword. Yes, they are as simple to invoke as "foobar".Left(3). See also c# extensions on msdn.
This question is similar to How to emulate MySQLs utf8_general_ci collation in PHP string comparisons but I want the function for vb.net rather than PhP.Recently I make a lot of supposedly unique key.Some of the keys are equivalent under UTF8 unicode collation.For example, look at these 2 key:
If I paste that into front page, and look at the source code you'll see
Note: In stack overflow they still look different.I know it's not the same. I guess even in stack exchange it doesn't show. Say I have 1 million such records and I want to test whether 2 string WILL be declared the same by MySQL UTF8 collation. I want to know that before uploading. How do I do that.So vb.net think that those are different keys. When we created mysql query and upload that to database, the database complain it's the same key. Just one complain and the upload of 1 million databases will be stuck.We don't even know what the hell is ? Where can we look that up anyway?Anyway, I want a function that when given 2 strings will tell me whether they will count as the same or not.If possible we want a function that convert strings into their most "standard" form.For example, seems to encode nothing and the function would recoqnize all those nothing character and eliminate that.Is there such thing?So far this is what I do. I need something more comprehensive.
So I was assigned to create a calculator that can calculate the sum, product, difference, & quotient using an external class. Unfortunately my teacher isn't exactly the best and I'm new to VB, I know how to create a calculator in VB .NET but when it comes to external classes,
I want to execute the code that is passed as a string to my function, the code will be passed at runtime. This is an example code that may be passed as a string to my function. p is a dataset, which is declared and has some values, this code is executed in a asp.net page
actually im new with VB 2008. i need some help to solve my project.i create table at excel 2007. in that table, i insert function so that when i key in some value, there will be some result at that table. my problem is how to import table with that function that i create in excel 2007 to VB 2008 so that the table with function appear at VB 2008? please help me..i really need help to solve my problem..
adding the from line in the below code. It works fine now, but I would like to add the from line and send it on behalf of a group distribution list. I have tried multiple combinations such as From and .from, sendfrom, mailfrom, fromto.
een using excel extensively. In excel I use vlookup function to connect and retrieve data from other workbooks. I want to know how I can do it in VB. So far I have created a form.The form has say three text boxes viz (i) A unique Number (ii) Name (iii) Address. I want that when I write the unique number in the text box for unique number the other two text boxes i.e. of Name and of Address should be auto populated. I have also established and tested the connection with the access database file using ADO.NET. I do not know whether I need to write an SQL or LINQ query for this purpose or I should write some codes. What should i do it and how should i do it?
I have a function in VBA that I need to convert into VB.net:Sub Crossfunction(ByVal Array1 As Decimal, ByVal Array2 as Decimal) As Boolean
Dim C As Variant Dim Above as boolean Array1 = Array(1, 2, 3, 4, 5, 6, 7, 8, 9) Array2 = Array(1, 4, 3, 7, 5, 8, 7, 2, 9)
Is this the correct method? And how can I convert the function and not get an error: Error 1 Value of type 'System.Collections.Generic.List(Of Decimal)' cannot be converted to '1-dimensional array of System.Collections.Generic.List(Of Decimal)' when I redefine the Arrays as: ByVal Array1() as List(of Decimal),ByVal Array2() as List(of Decimal).
I am trying to essentially convert an Excel spreadsheet into a Windows Form. On the first worksheet I have setup an IF statement to work as a search function =IF(C10="","",VLOOKUP(C10,'Price List'!$A$2:$D$40008,2,FALSE)) to read a price list on a separate worksheet. It works by taking a partnumber then puts the description in the next column (description column) and then the price in the "price each" column then finally totalling the row based of the quantity selected (see below).[code]...
I have a vb.net function which uses oledb to create a spreadsheet, then treat it like a database, creating tables and inserting values. The function takes in a filename and a dataset, and returns the filename if it worked. The function works beautifully on my dev machine, but not other PCs. Below is my function, is there anything wrong with the code? EDIT: There are no errors being thrown, the resulting file doesn't contain any data.
I'm attempting to use the VLookup function to look up a raw score and convert it using an excel worksheet. However, instead of returning the figure in the lookup location, its returning the value that i'm looking up. For example, i'm looking up the number 5, it should give me the value of 63 but instead of returning the value 5.
EDIT: The above code DOES work, but it does not work with the following code(returns number i'm sending). One thing I did notice, it doesn't seem to be looping through all the Subnames...I just get one result and there are 10 in the TEMP table.
I want to make an numerical integration method with takes in an analytic function and integrate it over a specific interval. For the numerical integration procedure I want to use some procedures in nr.com. The problem is that these are programmed in C++ and they uses functors to pass a function to the integration method. How can I do this in VB 2010?
I want to initialize the function (i.e. set a=1,b=0 for function y(x)=a*x+b) and then pass the function to the integration method. Then when the integration method call the function it only calls the function with one parameter (i.e. x since a,b is already set)
What is the best way to do this in VB2010?I want to make a general integration method where I can pass any single valued function and integration limits.
I have just started using VB, and from what I have found so far it seems like the tools you have is
- to us a delegate for the function - to use a lambda expression for the function - send a pointer/adressOf - to create a function class/structure and submit this to the function
As for now I am most inclined to create a function-class. But I am not really sure how.F.ex. I make different classes for each "uniqe function" I want to integrate, but how can I pass them to the integration function when I need to specify the argument type in the integration-function-call?This seems like a basic problem which applies to many Math operations, so I think it would be very useful to clarify this.