I have been a VB user for quite a long time starting from dos-basic types. But only now I encountered with a quite a newb problem :) I tried to search MSDN for it for about a few days and at the end I have to ask this question here because I could not find anything about it.
From time to time I use functions or subs where one parameter is a word from a defined list.
E.g.
private function my_function(byval THE_PARAM as string) as ..........
where THE_PARAM could be "work", "home", "bus", etc. 5 words all together.
How can I define a function so that when I use it on the text of the program I had a hint not just like "THE_PARAM is a string", but I had a choice of those pre-defined words, so I could choose a word from that list.
I have a query that can be summarised in SQL as follows;
Select S.StockCode From StockToCheck As S
[Code]....
Where the S var is a list of strings. This gives the error 'S' is not declared and points to the S in the function call / join (GetPOSStock). So it does not seem possible to do this in Linq, can anyone confirm?
I am creating a function and want to have IntelliSense pop down the list of valid options for a certain parameter in the same way that the MsgBox function behaves when you are typing your argument for which buttons you wish to include (such as MsgBoxStyle.OkCancel). I have done my best to search the internet but haven't found a thing which comes close to what I'm seeking. My monkeying around hasn't produced a satisfactory solution, yet, either.
A related additional thing, which I can live without but that would be nice to have, is the description of the current parameter, which appears below the function description as shown highlighted below MsgBox (Prompt As Object, [Buttons as Microsoft.Visual Basic.MsgBoxStyle = MsgBoxStyle .DefaultButton1], [Title as Object = Nothing]) AsMicrosoft.VisualBasic.MsgBoxResult
Buttons: Optional. Numeric expression that is the sum of values specifying the number and type of buttons to display, the icon style to user, the identity of the default button, and the modality of the message box. If you omit Buttons, the default is zero. This is my first post. I'm relatively new to VB .Net.
I want to have a "template" function that can receive different parameter and a type parameter, like:[code]But Vb told me that tupeList is not defined... is there a way I can do that?
I am trying to create a function that will take a fixed value, and increment another cell. It does this until another cell using a formula equals the fixed value. You can see what I have below, but this is my first VBA programming ever so I dont know exactly how to declare everything.
Function meetMargin(Margin, calcM, nrc) Dim x0 As Double, x1 As Double, x2 As Double, t1 As Double t1 = 0.05 Do While t1 >= 0.01 x0 = Range("Margin").Value x1 = Range("calcM").Value [Code] .....
I need to write an application that does the following, and I figured it was a good opportunity to write my first VB.Net application:
1. Get the list of fixed disks in the computer 2. For each disk, recurse through all its directories and sub-directories looking for filenames that match a given regex (eg. MyFile.d{3}) 3. If found, hash this file to get a unique ID, eg. MD5 (just to check if this file already exists elsewhere) 4. If this file hasn't already been seen elsewhere on the disk, copy it to a central directory
I need to execute a stored function in oracle or sql through vb.net. I created a command object. Depending on the database type(oracle or SQL) i am preparing the Command text as Select functionName(?,?,?,?,?,?,?,?) from dual; (For Oracle) Adding the parameter values of the function. Now performing the ExecuteScalar which is not working saying invalid parameter. This works with ODBC connection string. But ODBC doesn't with 64bit. My Requirement: Code should execute a user defined stored procedure by taking the values at runtime.
I have two datagridviews in my app. They're related. When there is no record in the parent datagridview, I select the "New Row" and then press the Add Button in the child datagridview's bindingnavigator. Then I get that exception:
InvalidOperationException: Item cannot be added to a read-only or fixed-size list.
I know why this happens.When I add new record to child datagridview, parent datagridview's new row loses focus and then delete row. So this error occures.How do I prevent my program from this exception. Remember, it's only occures if there is no record in the parent datagridview.
I want to make a GetAllContacts method which takes a sort parameter of type Func(Of Contact, TKey) which is the same type that the OrderBy method for an IEnumerable(Of Contact) takes.[code]"Too many arguments to extension method 'Public Function ElementAtOrDefault(index As Integer) As Contact' defined in 'System.Linq.Enumerable'." on the second parameter.
I have implemented inheritance for two parent classes called Table and Field. Each parent class has several child classes. In the Table parent class, I created a method that expects parameter List(Of Field).
I get an error when trying to pass in parameter List(Of ChildField) to the method that expects a parameter of List(Of Field). The error message is as below:
Value of type 'System.Collections.Generic.List(Of com.hlb.icisbatch.data.ChildField)'
I'm trying to code a class of RandomNumber. One of the class methods needs to populate a "List (Of RandomNumber)" ... which was passed as a parameter to the method ... with 10 random numbers between 1 and 50. DEAD SIMPLE :)
The following two statements seem the same to me but the first throws a design time error, and the second does not. The first one is passing the first parameter in hex and the second passes the first parameter as its decimal equivalent.
Public Shared ReadOnly Test As New Guid(&HCC58E280, &H8AA1, &H11D1, &HB3, &HF1, &H0, &HAA, &H0, &H37, &H61, &HC5) Public Shared ReadOnly Test2 As New Guid(3428377216, &H8AA1, &H11D1, &HB3, &HF1, &H0, &HAA, &H0, &H37, &H61, &HC5)
Here is the error associated with the first statement:
Error 1 Overload resolution failed because no accessible 'New' can be called with these arguments: 'Public Sub New(a As Integer, b As Short, c As Short, d As Byte, e As Byte, f As Byte, g As Byte, h As Byte, i As Byte, j As Byte, k As Byte)': Constant expression not representable in type 'Short'. 'Public Sub New(a As UInteger, b As UShort, c As UShort, d As Byte, e As Byte, f As Byte, g As Byte, h As Byte, i As Byte, j As Byte, k As Byte)': Constant expression not representable in type 'UInteger'.
I have a statement: dat.XoaNhanVien(Me.dtgcapnhatthongtin.CurrentRow.Cells(1).Value, message) That is a function for deleting info. Now I want to create other function and get above function to parameter. I mean: Public Function func(Byval func as " What type can be ?")
I am using visual basic and trying to create function. I am getting this error: "Argument not specified for parameter '_IsDayRateCheckBox' of private function CalculateParikingCharges(_HoursDecimal As Decimal, _IsDayRateCheckBox As System.Windows.Forms.CheckBox) As Decimal'.
This is the code. Private Function CalculateParkingCharges(ByVal _HoursDecimal As Decimal, ByVal _IsDayRateCheckBox As CheckBox) As Decimal
This is how I call the function. Dim HoursDecimal As Decimal Dim AmountOwedDecimal As Decimal If Not Decimal.TryParse(HoursTextBox.Text, HoursDecimal) OrElse HoursDecimal < 0D Then ErrorLabel.Visible = True HoursTextBox.Focus() [Code] .....
Can I pass a form as a parameter in a sub like public Sub GetData(Byval Frm as form) and access its controls?I have few forms (you can say: FrmAccounting, FrmEngineering, FrmIT) with almost the same controls in each of them (txtEmployeeID, txtEmployeeName, optMale, optFemale etc), where no two forms are open at same time, and each of those forms have a Button which opens a new Form (you can say FrmCollectData) now I want to fetch data in FrmCollectData depending on which form it was opened from.. like if user was on FrmEngineering and it clicks button to open FrmCollectData.. form collectData fetches data from FrmEngineering Controls and if user was on FrmAccounting and it opens FrmCollectData, form Collectdata fetches data from FrmAccounting..
earlier, in VB6.. In one of the Sub written in frmCollectData I checked which form is opened by setting flags in each of forms (frmEngineering, frmAccounting etc) and then I passed the same form in a sub which writes data in frmCollectData controls.. but am not able to do the same in VB.NET.
i am designing an application in which contents of an excel file are displayed in the ListBox. i have created a class which contains methods for doing this. Statement used for function call is:
I'm currently working on a school project and I have stumbled upon various problems. I'm supposed to write a software tool based on a mathematical model.
In total, the model has 12 parameters and 2 constants used in it, so I figured it would be a good idea to store the parameters in 2 separate arrays - one containing 6 parameters which have to be entered by the user and another one with another 6 parameters which should only be changed in a settings kind of window for tweaking (they are set to default values provided by the model).[code]...
it seems always at this time I cant figure out how to do something maybe it has something to do with lunchtime.
Im having trouble using a method that is defined by an outside company
This is a link to their integration guide:
[URL]
This is their documentation for the class Im trying to use
OrderQueryWebService Class
This class is for SID in particular and is made for use with the notification methods. This is for the Order Query Web Service specifically, allowing clients to return the status of transactions for their merchant, whenever they want to.
Methods / <summary> / Pass through the variables required and receive a list of Transaction objects showing transaction status
[Code].....
The MerchantCode, the MerchantUsername, the MerchantPassword are all good the List is a custom type called SetComHash.Transaction
Everytime I try adding a string to the list such as the transactionNumber and some other values it gives me a type error:
"Value of type string cannot be converted to 'SetcomHash.Transaction'
I've got a little function that just changes empty and null strings to "null":
Public Function CatchString(ByVal stringValue As String) As String If stringValue = "" Or stringValue Is Nothing Or stringValue Is DBNull.Value Then Return "null"[code].....
I added the bit about DBNull because sometimes it gets null values from a database. This doesn't work, though, because it won't take DBNull as a parameter.I tried changing the stringValue parameter from a string to an object, but then the If statement gives this error:
Quote: Object reference not set to an instance of an object.How do I make the function accept DBNull as a parameter?