Statement And Command Concatenation?
Jun 1, 2010
i am currently working on a small project, but to be honest i am quite new to VB i am trying to run this code:
For i As Integer = 1 To box_select_solp
cell_solp_text(i).Controls.Add(New LiteralControl("SOLP" & i & "#: "))
Next i
View 1 Replies
ADVERTISEMENT
May 23, 2011
Lets just say we have this as Command1 Dim Command1 = "whoami.exe >> C:Hello.Txt" The program will read a list of users from a text file and then perform the action on each of them. If the user does not exist, or they are part of a password protected computer, I would like to see that in my printout. I have this but am Unsure how to write the If Then Statement (If that is the ebst route to take)
[Code]...
View 2 Replies
Jan 27, 2010
I am using a Command Builder for OLEDB, I populate the Data table from the database, and then I use data adapter's Update method to add or update the database successfully.
[Code]...
View 5 Replies
Nov 19, 2009
I am using an INSERT INTO ... VALUES statement in the following matter to insert data into a new row of a database:
[Code]...
How can I substitute variables for the explicit values of X and Y in this statement (for example, variables XName, XAddress supplied by user input via text box)?
View 6 Replies
Feb 15, 2012
I seem to be having a problem when attempting to insert a new record into my database through vb.net. From what I can gather, there seems to be an error in the code that the command builder (cBuilder) is creating for me. [code]...
View 5 Replies
May 15, 2008
I've spent the last 3 hours trying to figure out why this string won't concatenate.
The function takes in a mapped drive letter and creates a UNC path and returns it.
Any thoughts welcome:
View 9 Replies
Oct 18, 2011
In VB.net, I tested concatenating 100k strings and found out one thread alone did it in 23 milliseconds. Two threads (each concatenating 50k) then joining the two at the end took 30 milliseconds. Performance wise, it didn't seem beneficial to utilize multiple threads when dealing with only 100k concatenations. Then I tried 3 million string concatenations and two threads each handling 1.5MM always demolished one thread handling all 3 million. I imagine at some point using 3 threads becomes beneficial, then 4, and so on. Is there a more efficient way to concatenate millions of strings in .NET?
fyi, this is the code I wrote:
Imports System.Text
Imports System.Threading
Imports System.IO
[code]....
View 2 Replies
Jan 12, 2011
Is there any difference between & and + operators while concatenating string?if yes, then what is difference? And if No, then why below code generating exception?
Example:
Dim s, s1, t As String
Dim i As Integer
s1 = "Hello"
[code]....
View 6 Replies
May 8, 2010
I am wondering how to concatenate a string and an integer to form a button name.eg, ("button" & x) where x is an integer to form button1, button2, etc so i can change the backcolor of the buttons.
View 2 Replies
Nov 9, 2011
The below program throws a runtime error (invalid conversion from double) because there is [code]It compiles fine, but when the program is run, it throws a runtime error.Is this a compiler bug? Shouldn't it stop me with a compiler error, like invalid syntax ?
View 2 Replies
Sep 13, 2010
Possible Duplicate: The difference between + and & for joining strings in VB.Net.In VB.NET you can use either += or &= to concatenante a string (ignoring using a StringBuilder for this question -- this is directed at a very simple concatenation).
View 2 Replies
Aug 20, 2011
I'm trying to compose a String from multiple Strings, where some of the Strings may be in Arabic letters, the problem is that when I concatenate them, their order is being messed !!
For example, I have the following Strings:
Ref1
مسكه
2
Left
I want to concatenate them with the same previous order seperated by "-", but instead I get Ref1-مسكه-2-Left, as you can see, 2 is written before مسكه Does anyone know how to fix this problem, because it's really important in my case to have the exact same order, and I don't know where or when I might have these arabic strings, because it's being entered by User.
View 3 Replies
Nov 10, 2011
I have a windows form having combobox and textbox controls.. I have to generate a part number, consisting of combobox and textbox values included.. I can explain in detail.. This is the code i have used to define a variable "type"..
[Code]...
View 5 Replies
Apr 13, 2012
I am creating a program to simulate a tenpin bowling scoring system, and I'm using labels with the following name structure:
Player1Frame1Ball1, Player1Frame1Ball2, etc..
I have following variables also: CurrentPlayer, CurrentFrame, CurrentBall
I am hoping to use these variables to specify which label I would like to check the value of (the score achieved, placed in the label).
To test my experiments I have been trying to output the score of the first ball in the current frame in a msgbox, but to no success:
[Code].....
View 6 Replies
Jun 1, 2010
When I am concatenating object values together to form a string in VB.NET, is there a difference in performance or a recommended best practice between using the & concat or the + concat with calls to .ToString() on each object?
Example (which is faster or best practice):
Dim result1 As String = 10 & "em"
Dim result2 As String = 10.ToString() + "em"
View 4 Replies
Nov 24, 2010
I am facing a really very interesting problem with string.
My code is
[Code]....
But when I comment those lines (which are uncommented in code above) its working fine.
I am taking value in filepath variable from file dialog's FileName property.
EDIT: I have also compared the values of variable stropt and strwithpara with "IF" condition and found those are same.
View 1 Replies
Jun 14, 2012
I'm trying to concatenate two properties into one string like so:
public class thing
public property word() as string()
public property count() as integer()
[Code]....
This is what I want, but it doesn't help that its in the debug output...I need to put it into a single string. I've tried using a_thing.count(i).tostring, but it doesnt work. If I look at the arrays individually, they have exactly the contents I want. But I can't concatenate them. Does it have something to do with suppressing the new line that debug.writeline usually creates?
View 1 Replies
Jan 25, 2012
I have combobox for year and combobox for month concatenated to make the date format "2012-01" My db field is RecordDate and is smallDateTime In my select statement im trying to use the left function to find match my concatenated string to the RecordDate field.Here is my code, hopefully someone can help me. Currently im getting the error "Conversion failed when converting date and/or time from character string."
Dim newRecordDate As String = (CStr(ComboBox2.SelectedValue)) & "-" & val1
Dim val10 As String = CStr(Convert.ToDateTime(newRecordDate))
Dim val21 As String = Microsoft.VisualBasic.Right(val10, 7)
MsgBox(val10)
[code]....
View 5 Replies
Mar 29, 2011
I've got a small app which I use to start a 3rd party application. When run from a shortcut the VB app starts the 3rd party app to and when loaded it displays its own file/folder interface, the VB app the closes itself. However, if you open a file in explorer associated with the 3rd party app, the 3rd party application loads and opens the file itself and not the file/open interface.
Uh OK, so what's the problem??The issue is I have changed the file extension associated with the 3rd party app to now use my VB app. I can successfully open files with the app from explorer if there are no spaces in the file or folder path however if there are, the 3rd party app opens and displays a File not found error message and gives the path up to the point where the space then follows.The relevant snippets of code from the app relating to the issue is below, specifically Dim Arguments variable where I am not quite sure how my string cocantenation should be to deal with the value of the variable 'Filename' which may or may not contain spaces.
[code]...
View 26 Replies
Apr 30, 2010
First let me say that I am not sure whether or not this should go in this section or the API section, and if it needs to be moved I apologize. My issue is fairly straight forward, but for some reason I cannot get it to work.
I am trying to send a command to a command line and then submit the command. I have been trying without success to get this to work in v2008 Express and v2010 Express, Here is the code I am trying to us:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String _
[Code].....
View 6 Replies
Apr 12, 2012
I have a simple question about string concatenation. Following is the code. I want to ask why s6 = "abcde" and not "akcde"? I have change the s2 value to "k".
Public Class Form1
Public s1 As String = "a"
Public s2 As String = "b"
[Code]....
View 5 Replies
Mar 17, 2010
I am currently using psexec.exe from PsTools to send a command to a remote system to fire a command through a command prompt however I am finding that the shell I am doing does not seem to like the spaces in the path.
[Code]...
View 3 Replies
Nov 8, 2007
Any ideas on how I handle the following error thrown in the SqlDataAdapter.Fill as a result of the BeginTrans in the callee?
System.InvalidOperationException = {"ExecuteReader requires the command to have a transaction when the connection assigned to the command is in a pending local transaction.The Transaction property of the command has not been initialized."}
[code].....
View 7 Replies
Jun 30, 2010
Public Sub ExecuteTransaction(ByVal connectionString As String) Using connection As New OleDbConnection(connectionString)
Dim command
As New OleDbCommand()
Dim transaction
As OleDbTransaction
[Code]...
View 1 Replies
Feb 24, 2010
I am using the following code to run defrag and to analyze if the C: drive requires defragmentation:
Dim analyze As Process = System.Diagnostics.Process.Start("C:WindowsSystem32defrag.exe", "C: /a /h /u /v")
This process runs through analyzing, runs it in normal mode & prints the progress to the command window.
My problem is that as soon as the process is complete the command window closes. I need it to stay open so that I can read the results.
View 3 Replies
Mar 11, 2010
I am trying to send a command to the external command line (cmd.exe) from the Windows form application that I'm writing in VB.NET (using VS2008).
I can only access the external program thru the command line (its not my program) and I must do so from a form app.
I am trying to use the following code. I am able to call a cmd.exe window, but I can't pass the command line my command.
Using mp As New Process
With mp.StartInfo
.FileName = "cmd.exe"
[Code].....
View 8 Replies
Oct 14, 2009
See
Public Class Form1
Dim sql As String
Dim conn As New OleDb.OleDbConnection
Dim da As New OleDb.OleDbDataAdapter
[CODE]...
The problem, The INSERT statement works fine in the form load but not in the button click event?
View 29 Replies
Jan 1, 2010
I was convinced that If <expression> Then <statement [:statement]> Else [statements] in concrete form of If a = b Then SayHello() Else SayBye() End has sense. I read article on msdn on If-then-else, but I forgot why I was reading, so I concluded, that snippet above means this
If a = b Then HelloIsSaid : IsNotEnded Else ByeIsSaid : IsEnded But I have tested it now, and I see, that Else without statement is nothing more than decoration. It would be pretty good if it had function I described. Do you think its good request? Or do you know any circumstance where this Else has some function?
View 13 Replies
Jun 8, 2009
y friend and I are re-learning Visual Basic, and we are stumped on this bit of code.
For intAsterisks As Integer = 0 To intLine - 1
lblAsterisks.Text = lblAsterisks.Text + "*"
Next
View 6 Replies
Jun 24, 2011
I have the following SQL:
[Code]...
I want to put it (the select count statement) in this LINQ statement so I can get the sales count in my linq statement: Dim TheLeads = (From L In DB.Leads Where L.IsDeleted = False Select L).ToList() Is this possible to do in LINQ?
View 1 Replies