I'm learning to use this program and I'm a few weeks into learning it and I'm understanding most of it fine, but I just cannot get a grasp on when to use CDbl, CInt, CStr etc. functions. Here's an example of a few lines of code I can't get a grasp of:
If IsNumeric(txtFirst.Text) And IsNumeric(txtSecond.Text) Then
txtSum.Text = CStr(CDbl(txtFirst.Text) + CDbl(txtSecond.Text))
This program is supposed to take 2 numbers that are inputted by the user and add them together. simple. I was playing around with it, and I took out the CDbl and CStr functions, and the 2 numbers that were supposed to be added together were only added side by side (ex. If I input 2 and 15 as my numbers it would spit out 215).
So I'm curious when to use these functions.
My first nagging question is, how come on the second line, it says CStr(CDbl(? Why would I need to convert to double, THEN to string? which is my understanding, unless I am reading this wrong.
Another question I have is, if I declare var1 as Dim var1 as Double I constantly see the next line as var1 = CDbl(txtbox.text) and so on. I don't understand why we need to convert to Double here, since when I declared the variable as a double, it should already be in a double form already, shouldn't it?
I just want to know, what exactly the difference between the functions CStr() and Str() and also the .ToString()? With the code provided below, what's the difference between the three?
I had until recently been under the impression that the CDbl(x) operation in VB.NET was essentially a cast (i.e., the VB equivalent of (double)x in C#); but a recent discovery has revealed that this is not the case.[code]d will be set to the value -12345.12345! Now, don't get me wrong, this is kind of convenient in my particular scenario; but I have to admit I'm confused as to why this works. In particular, I'm confused because:[code]How is CDbl so clever?
I am using the following code to get all my database fields, I would like to convert one of the fields to Cdbl, not sure how to do that
Dim comm As New OleDb.OleDbCommand("Select * From " & Me.OpenFileDialog1.SafeFileName & " Where Status <> 'S'", con)
I know how to individually do it field by field but i dont want to have to write a select for each field if that makes sense?
Dim comm2 As New OleDbCommand("Select Cdbl([Selling Price]) as SoldPrice, Status From " & Me.OpenFileDialog1.SafeFileName & " Where Status = 'S'", con)
So something that pulls ALL fields and converts one
How can I get this to display in currency format. Righ now it's coming out with the right math but only carrying one decimal place and I get no dollar sign.[code]
Is there a way to see exactly what the functions are doing. What i mean is there a way to see the class? I know what it does, i just want to know the code. For example the function: Membership.FindUsersByName()
When you refrence a Function like this one:[code]You may want to be able to get more out of that, like this.[code]So how would I be able to add subs or functions onto a sub or function like that?
I have made quite a good library for calculating Math problems like Quadratic Equations and many other. Now I met a friend, and hes programming a little in VB, and we were thinking if it is possible to import my functions from C++ to his code, so he can call them, when they are needed, so we can make a calculator? How can we do that?
Edit: My friend is using VB.net Edit: My library is organized in free functions.
I am not sure if i am using these in the correct manner. Basically i have an app that downloads a file from an ftp server (i am kinda cheating cos i am using chilkat). Now if i put the code directly in the form i can get it to do a progressbar.value = ... in it['s own sub.What i decided to do was stick my ftp download parts into a dll i created. Created a function within the dll and i have a return on that which returns the message 'file downloaded' or 'no file to download'. But can i return a value to update the progress bar as it goes when the code is contained in a dll? Or am i totally missing the point and how to use dlls?
I want to ask help from you guys, about on how to use the listview functions in vb.net. I also just starting to study about the vb.net for my object-oriented programming. Please help me in writing the codes for a simple listview.
How do I check which functions are in a dll I don't who's contents are unknown to me? I am looking to use a certain function and I have a couple of dlls and I don't know in which one it is are its name. So i need to be able to show all function available in a dll and their parameters.
I'v got 3 functions that I'd like to combine into 1. There is only one line in each function that changes. can think of a few ways off the top of my head, but not sure which is "the best", or "proper way" to accomplish this.
Private Function CheckQuads(ByVal QuadNumber As Integer) As Boolean Dim intArray(3) As Integer Dim x As Integer = 0
We know some functions in dll files and can use them but if we haw a dll file and dont know functions names. is there a way to get the functions name and their parameters
I am new to visual basic and currently doing my major project on sending sms using visual studio 2005. I want to create it in window application. I have search the net but I could not understand it. I have download some of the project that the net has found for me but when i test it the receiver did not received any message but the application have come out the popped out box saying "message send".
Does VB.net have anything built in for graphing functions? Linear, quadratic, cubic, log, and absolute value functions would be my main needs. I would want to display the functions on a graph whose x- and y-axes both go from -10 to +10, with grid lines.
I am fiddling with the code here: [URL] I had a couple errors when I copied/pasted it into my project. I dimmed a couple variables, now the squiggle lines are gone, but I'm not sure how to call the functions in the project? Do I use a Lable or a TextBox? How do i make this work?
I am working on a migration project of vb6 to vb.net, in vb they did some string actions with left, right, mid functions. How to achieve the same in vb.net.
How do you use the e.graphics functions? I have visual studio 2010 professional installed. I opened a windows form project, in the code window I type e., there's only End. or Enum., no e.! Do I need to import something at the beginning, or do I need to open certain type of project to use the e. graphics class of functions?
I have a visual basic file with a number of functions I want to use inside my XSL. I can build it as a dll and reference in my XSL project but I don't know how to reference it in my XSL file. I am using visual studio.[code]...
I am currently working with an IPhone API which consist of about 40 pages of aspx along with their respective aspx.vb pages. They are all partial classes because the API continues to add other phone platforms to it. Currently I have them residing just in a folder. /API/0.1 and /API/1.0..How would I call the functions from those IPhone API classes without having to put them in the App_code? [code]How do i use that function in a webform? or do I need to put it in App_Code? [code]
I am trying to use the same form for several functions which means I have to change the properties. In order to do this, I was trying to put a select case in a module that could be recalled anywhere in the project.
As soon as I start a select case in a module, I get an error message "Error1Statement cannot appear outside of a method body." Does that require that it be in a form only and cannot be used in a module?