VS 2008 String Compare - Why The Fallowing Function Returns 0
Jun 1, 2012
is string.empty = "" why the fallowing function returns 0
vb.net
Dim String1 As String = String.Empty
Dim StringEmpty As String = ""
MessageBox.Show(String.Compare(String1, StringEmpty, False))
View 3 Replies
ADVERTISEMENT
Jul 4, 2011
Here is my code for the string comparison function
Public Function CmpKeys(ByVal oldkey As String, ByVal newKey As String) As Boolean
Dim cmpText As Integer
[code]....
My question is whenever I compare "alt+ctrl+w" with "alt+ctrl+W" it tells me that both the strings are the same, but as you can see that both of these strings are not equal because it got small 'w' and the other one is 'W', how come both of these strings are equal?
View 5 Replies
Mar 18, 2011
i am trying to write a function which should return a 2D array , please advise what is wrong with.
vb.net
Public Function Cursor(ByVal SQL As String, Optional ByVal PARA1 As String = "", _
Optional ByVal PARA2 As String = "") As String(,)
Dim Cols, roWES, I, J As Integer
[code]....
View 3 Replies
Jun 23, 2009
The idea is to expand on the existing, old, and lacking Inputbox, to allow for:1. A greater variety of types (Integers, doubles, List(Of String), etc.2. Data validation.For example, if the user wants the user to quickly enter an Integer, I want a custom Inputbox form to show up with a TextBox, which only allows Integer input. If he wants the user to choose from a List(Of String), I show a form with a Combobox instead, from which the user can then choose.
View 8 Replies
Dec 12, 2010
my app is calling a dll that returns SQL details to a bufferred string, here is what i did 6 Dim server As New String(" ", 256) when i use this in sql connection string i get this error: Format of the initialization string does not conform to specification starting at index 22.
View 10 Replies
May 9, 2011
I'm trying to create a function that would return a PDF document. Something like this:
Function GetPDF(ByVal DirectoryPath as String) as PDF
Return DirectoryPath
End Function
View 1 Replies
Mar 25, 2011
I have to cut down the amount of code in my blackjack program so im trying to use a function however the function always returns a value of 0 I have tried putting in "return cardvalue" but it still comes out as 0 I dont know where I went wrong or if the code im using can even be used as a function.
Function Values(ByVal deal() As Integer, ByVal counter As Integer, ByVal cardvalue As Integer) As Integer
If deal(counter) = 1 Or deal(counter) = 2 Or deal(counter) = 3 Or deal(counter) = 4 Then
[Code]....
View 4 Replies
Apr 28, 2012
I wrote a vb program that would prompt the user to enter a number and then enter the exponent value they wanted the number raised to. When they clicked button 3 it did the calculation. everything worked perfectly.
Now I need to change the program. I must create a function in a module and then call that function from button3 click event. I have tried several different ways and even though it seems to "work", it keeps returning an incorrect value![code]...
View 6 Replies
Mar 9, 2009
I have to create dinamcly a Table ( not a DataTable) and I need to write the Functions in other class... so I need to create a function that Returns a Table to make possible I just atribuite the Table to my <asp:Table> control.
[Code]...
View 3 Replies
Feb 10, 2012
I need top create a function that gets the next integer in the sequence of 1 to 60. Each time the function is called, I need it to increment from what the last value was and return the next number as the result. It also cannot return the same integer in 2 consecutive calls. When the count gets to 60, the sequence needs to reset back to 1. I would like to function to have no parameters.
I have created a function that does this using the cache to store the last value that was returned, but I am worried that with concurrent calls to the function that it might not work as I expect and 2 calls could get the same integer.
Is cache blocking the correct method to use in this instance or is there something other method I am not thinking about?
Also, stuck using .Net 3.5 and this is a web application.
I just wrote this function based on using SyncLock. Any obvious problems with it that I don't see? I am using the Cache to save the last value that was returned.
Private Shared Function GetNextNumber() As Integer
Dim o As Integer
Dim r As Integer
[Code].....
View 4 Replies
Jul 21, 2010
I have a function that returns a bitmap meant to be used as background in a panel, and occasionally I'd have to call it to create a new background based on parameters
View 2 Replies
May 5, 2012
How can I call individual parts of this function? I would like to call return Gallons and decPaintCostperRoom as individual entities with a single function.
[Code]...
View 5 Replies
Apr 2, 2011
i hav two openfilefialogs(1 and 2). So i also have a listbox. the files opened with the openfiledialogs will be added to the listbox. and when i need to open the files i need to see if they are from which openfiledialog. so
it is like this.
Path.GetDirectoryName(OpenFileDialog1.FileName) & "" & Form3.ListBox1.SelectedItem.ToString
'if this returns a null then go to this
Path.GetDirectoryName(OpenFileDialog2.FileName) & "" & Form3.ListBox1.SelectedItem.ToString
View 4 Replies
Mar 10, 2011
I have a function class in which I have created a function that connects to an Access database and runs a query and returns a dataset.
View 3 Replies
Apr 26, 2011
So I have a class called Transactions and I put all my functions there. The problem is, when I try to call that specific function and assign it to a variable, there is a "ByRef Argument Type mismatch" error that keeps on bugging me.
Public Function GetUserID(name As String) As Integer
Dim gotID As Integer
Dim rec As Recordset
Call connectDB
sSQL = "select ID from User where Name ='" & name & "'"
Set rec = CurrentDb.OpenRecordset(sSQL)
[Code] ......
View 1 Replies
Dec 5, 2010
I have just received some documentation for an Interface and a class implementation, and I had a question about the return type defined in the interface. here is the function from my interface (I have abbreviated the parameter list in the SearchAddress function).my concern is the SearchAddress function.
Public Interface IAddress
Property AddressID As Long
Property AddressTypeID As Long
[code].....
View 6 Replies
Nov 25, 2011
Im making a login system that encrypts and decrypts the username and password. My encryption code is:
Private Shared Function enc(ByVal targetString As String, ByVal maskvalue As String) As String
Dim Index As Integer = 0
Dim ReturnValue As String = ""
[code]....
The enc function works for both encrypting and decrypting (I've tested with a MsgBox alert. The problem I'm having is when the program loads, it reads the file and decrypts it. However, instead of properly working, it returns one character in the first textbox and nothingin the other without any error being thrown.
View 1 Replies
Apr 15, 2010
I am working on a project that requires me to hop into to separate DB's. So I have figured that I need to have multiple functions inside of my VB page. The only problem I am having,is I am not to sure how to get this all accomplished. So far I have figured out the overall structure, just need to implement that structure.
Here is my idea:
The main Function would call two other functions. We can Call them Sub Function 1 and Sub Function 2. So, the main Function takes the saved sessions information for the E-mail address and dumps in into Sub Function 1. It needs to open up a new connection to the db/stored procedure and RUN the following procedure and then return the result. Here is the stored procedure and what I think is correct.
CREATE PROCEDURE WEB_User
(@EMAIL_ADDRESS varchar(80) = [EMAIL_ADDRESS])
AS SELECT MEMBER_NUMBER
FROM WEB_LOGIN
WHERE EMAIL_ADDRESS = @EMAIL_ADDRESS
So my question is, what is the function suppose to look like? how do I send the session information to the procedure? and finally, how do I return the stored procedure results and push back into the main function so it can be carried into sub function 2?
View 1 Replies
Mar 21, 2012
In our code base there is a function which should return either an object or nothing. The exact code is this : Return NothingThe calling method looks something like thismyObj = theClass.function()if myObj <> nothing then // fails
View 1 Replies
Dec 7, 2010
I call a function (SaveChanges) to access my business / data layer and save any changes to fields that are marked as an Add or Update and are marked to be processed. This function used to work fine up until 60+ minutes ago. What is happening is that suddenly the function is returning false. After debugging through the code, when it hits Return the local boolean is set as True but when it gets back to the calling method (and uses the return value) it is now False. As I said I went through line by line and debugged it, then I added a watch to it. The funny part is that there is one spot that sets the Boolean to false, and when I put a breakpoint on that spot it is never reached.
Here is the function:
Private Function SaveChanges() As Boolean
Dim blnSaved As Boolean = True
Dim saveableRows As List(Of DataRow) = (From d As DataRow In _listData.Tables(0).Rows _
Where Not d("Marking") = "Duplicate" _
And d("Process") = True _
[Code] ....
View 4 Replies
Oct 3, 2009
[VB.Net 2008 Express Edition]I have a 2D array of Integers called Map(0 to 79, 0 to 79)In this array I store IDs for tiles to be loaded later.I'm trying to write a module to generate a random dungeon every time it starts by making a room 10x10 tiles in the middle, picking a wall, making a hallway from that wall, and adding a room to the end of that hallway.From there it picks a random wall anywhere in the map, adds a hallway and a room, and repeats until the number of floor tiles is high enough [400 atm] The problem is that when the rooms and hallways are made, it first runs a function to return whether or not that space is empty. The problem is that even when I know for a fact the space is empty, it returns false. I don't understand why. Here's the Clear function.
Code:
Public Function Clear(ByVal Top As Integer, ByVal Left As Integer, ByVal Height As Integer, ByVal Width As Integer) As Boolean
'Returns whether a rectangle is empty
'used to loop through a rectangle of the map array
Dim introw As Integer
[code]....
View 5 Replies
Oct 29, 2009
I have a Function that returns a struct in VB.NET:
CODE:
Where as in my struct I have two variables:
CODE:
When I try to populate the structure as shown above, I get an a nullvalue exception.
View 2 Replies
Feb 11, 2009
This same (Identical ) code works well in another program but does not in windows service... Returns 0 for window handle ...?
Public WindowStr As String = "ImagSrvWindow"
Protected Overrides Sub OnStart(ByVal args() As String)
'necessary to get control to paint Pic&Txt boxes in stream of Browser navs
[Code].....
View 7 Replies
Mar 13, 2011
Code Block 1 First I am calling my function to obtain a pixel color at a specified coordinate.[code]The odd part is while looking at the results as a string they appear to be the same, but while using If Not TheColor.Equals() in code block 2 the program returns that they are different. Before threading code block 2 this was not a problem so I can only assume the threading is causing the problem. I'm unsure as to how I can fix this... Additional unrelated problems I am having are:
- On WindowsXP the colors being read are not the actual color as which the mouse is located.
- While using print-screen there seems to be a bit of lag and some times unreliability, is there another method to get a pixel color at a specified location? Note that GetForegroundWindow works on Vista/7 but not XP, and GetActiveWindow is unreliable.
View 5 Replies
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
Apr 25, 2011
I have a several form elements that I am dynamically creating with javascript when a user changes a number value in a textbox, by filling the innerHTML of a div like so:
dfinnerhtml = dfinnerhtml + "<div class='field'> ";
dfinnerhtml = dfinnerhtml + "<textarea name='textbox1" + suffix + "' type='text' id='textbox1" + suffix + "' value='' rows='4' cols='20' class='field'></textarea> ";
dfinnerhtml = dfinnerhtml + "</div> ";
Then, in the aspx.vb code behind, when the user clicks the Save button, I run through a series of Requests to try and add the values that are in these form elements to a SQL string:
Dim DFTestValue1 As String DFTestValue1 = Request("textbox" & c.ToString)
where c is a loop counter to the # of textboxes created (the input value mentioned above that triggers the create) The problem here is that this code works in Internet Explorer but not in Firefox or Chrome. The Request() value returns null and nothing is saved. I hope I've explained this well enough.
View 2 Replies
Jul 13, 2010
It's often the case that I can write a nice tight little VB.NET function, and when it comes time to do the Return statement, it's really natural to just return the result of a quick calculation or a method call. However, this makes it difficult if I need to step through the debugger to see what is going to be returned from that Function. For example, take this simple method to illustrate the concept[code]...
View 3 Replies
Mar 19, 2010
I am trying to format a Function Code so that it returns a 4 digit result no matter the entry by the user (i.e. they enter 540, stores 0540 in the database). While looking online, I've found the format function, but when I use it, it returns 540, regardless if I enter 540 or 0540. [Code]
View 2 Replies
Jul 28, 2011
I have a math program that I am working on. One of the exercises has a random word and 6 radiobuttons. The user has to select the radiobutton that displays the exact number of letters in the random word. What I am having trouble with is creating a Public Function to check if the answer selected is the correct one. The radio buttons are within a groupbox. The Public Function returns a boolean True or False.
View 4 Replies
Oct 2, 2009
just found out that replace(string does not do the same as string.replace when my string variable was an empty str the first one returns "nothing" and the second returns an empty string (as expected).just sloppy coding anyhow, it was a function that was converted from classic asp and never rewritten properly. [code]
View 1 Replies