.net - Concatenating A Variable Onto A Path(string)?

Mar 25, 2012

I am concatenating a variable onto a path(string), i'm using a message box to display this for testing purposes, I can see that the variable is starting on a new line, which in turn when i try to open the file it doesn't recognize that the file exist...

Dim Path As String = "C:UsersstefanDesktopUni WorkYear 4ProjectsProject SelectionProjectProjectinDebug"
Shapetext = clickedShapes.Item(nextShape).Text.ToString.Substring(0, clickedShapes.Item(nextShape).Text.IndexOf(" "))
MsgBox(Path + Shapetext + ".txt")

View 2 Replies


ADVERTISEMENT

Variable In Path String?

Apr 10, 2012

I can't seem to get this to work. I am just a novice plugger and do some of these forms for my work occasionally. I am assigning a textbox result to a variable. I then want to use that variable in a path string i.e. ("c:some stuffvarname") but the variable looses focus once placed inside the quotes.

View 4 Replies

Concatenating Using String Or String Builder Not Working?

Nov 10, 2010

I am using the following lines and am not able to concatenate the needed values, why it is not working.

Dim rxBuffer As String = " "
Dim rxData As String = " "
Dim rxDataStringBuilder As New StringBuilder[code].....

View 12 Replies

Asp.net - Concatenating String In LINQ-to-Entities?

Apr 7, 2011

This code works if I take out

" " + p.MIDDLE_NAME

Thus the remaining code looks like:

p.FIRST_NAME + " " + p.LAST_NAME

Maybe LINQ-to-Entities just doesn't support concatenating more than two strings at a time?

Protected Sub btnFilter_Click(sender As Object, e As EventArgs) Handles btnFilter.Click
Dim dbContext As Campus6Entities = New Campus6Entities

[Code]....

View 1 Replies

Change Function To Build Byte Array Rather Than Concatenating String For TCP Sockets?

Jan 5, 2010

I've been trying to reuse my bosses vb.net buildpacket code which he has successful used for Serial programming eg. SerialPort1.Write(buildpacket(useraddress,252,"0006","0") for the function listed below.My challenge.Create equivalent functionality for Socket BeginSend() which requires a byte array.Whether modifying the vb.net below or getting a c# equivalent to work, it has been repeatedly recommended to scrap the string concatenation approach for which I have to use Encoding.BigEndianUnicode.GetBytes() and then getting rid of extra bytes with zero values.

I'm lacking in imaging something different which would work for socket programming directly and allow me to eliminate all the hassles that c# integer conversions into string value that can be encoded trouble free.I would need to call the equivalent of the following that would return a byte array rather than a string with the following arguments

1. Source address (0-255)
2. Destination address (0-255)
3. Function code ("0001" through "0100")
4 Packet Data Unit (pdu - some integer value

[code]....

View 8 Replies

Concatenating A Variable With A Regex Group Match In Regex.replace?

Apr 5, 2012

I am having an issue where I am using regex.Replace to replace part of a string. The basic idea is that I want to capture the beginning of the string then replace the end of the string with a value from code. For an example pretend I have a string that says "Test Number " followed by number and I want to increment that number. I capture the "Test Number " but when I try to concatenate that capture with the new number it treats the capture ($1) as a literal and replaces the entire string with $1[new number].

[code]...

This will output "We are on Test Number 2", as expected. how I can use a variable in the replacement string portion of the Regex.Replace when including a captured group?

View 1 Replies

Search A String Variable And Place The Match Into Another String Variable In Visual Basic?

Nov 18, 2009

I'm looking for a way to search a string variable for two words and copy the text in between them into another variable. This needs to be done as many times as the match occurs.

View 3 Replies

Variable From Execution Path?

Jun 3, 2012

I am trying to allow my VB.NET EXE to have a variable defined by the run command. The problem is I have no idea what the terminology would be for this type of run.

For example - the shortcut is set to do "myexe.exe debug" This would set a variable to "debug" which on execution my app knows to enable a debug mode.I've done it in batch scripts before - it just enables the "%1" variable or "%2" based on the location (e.g. test.bat hello world - hello would be %1 and world would be %2).Hopefully I explained it well. I tried searching for "variable in execution path" and "variable on execution" with other mixes, but none of those searches return what I am looking for.

View 5 Replies

Declare DLL With Environmental Variable In Path?

Jun 18, 2011

How can I create a DLL declare statement with an environmental variable in it so as to make sure that I'm loading the system DLL from the right place, the system32 folder? For instance...

Declare Function GetExtendedTcpTable Lib "iphlpapi.dll" Alias "GetExtendedTcpTable" (ByVal tcpTable As IntPtr, ByRef tcpTableLength As Integer, ByVal sort As Boolean, ByVal ipVersion As Integer, ByVal tcpTableType As TcpTableType, ByVal reserved As Integer) As UInteger

The reason I'm asking is that there has been talk about people injecting invalid/malicious DLLs into folders along with applications and whatnot and I see this as an issue if you don't specify the SYSTEM directory. Yeah, I could specify it to load from c:windowssystem32 but what happens if a person doesn't have their Windows installed in c:windows? Hence the reason to use an environmental variable to find system32.

View 2 Replies

End The Variable Name With Path, Folder Or Directory

Mar 23, 2009

When im naming a variable for a directory should i end the variable name with path, folder or directory.

View 4 Replies

Save A Textfile To Variable Path?

Aug 18, 2010

I use the code below to save a textfile to a directory that should work like this[code]...

View 1 Replies

Unable To Set The File Path Of A Variable?

Mar 14, 2011

I am relativel new to using the .Net framework. I am trying to learn how to set the path of a file to a variable, and having no luck. I keep getting a message that indicates that the path can't be set. The error seems to be a runtime error. Here is the code

[Code]...

View 1 Replies

VS 2010 Merging An Integer Variable With A String Variable?

Jun 2, 2011

Say I have something like this

Dim Level1 as Integer = 83
Dim Goal as String
Goal = InputBox(" What level is your goal?")

[code].....

View 7 Replies

Assigning A File Path Using Text From Different Controls To A Variable?

Aug 10, 2009

I would like to create a filepath and assign it to a string (so that it can have yet more added to it later on in my program) the code takes (well i want it to but it doesn't) the name of a drive selected previously and then adds this to a string to create a string variable that refers to a file. and then (as usual) i want to use thes files and display them in a combobox but i want to only select files that have a pre selected 2characters at the front. I have got this code so far:

' search for filer drive NETAPP-1
For i = 0 To frmDatabase.drvDB.Items.Count - 1
If InStr(frmDatabase.drvDB.SelectedText(), "\Netapp-1malika", CompareMethod.Text) Then

[code].....

View 6 Replies

VS 2008 Changing The Path (environment Variable) Under VISTA With VB?

Mar 27, 2009

i need to change the "PATH" environment variable in a VB program (Visual Studio 2008). Here is the code i use to add the "C:TEST" folder at the end of the existing one.

test
Dim PathVal As String
PathVal = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.User)

[Code].....

View 5 Replies

Reading / Parsing And Concatenating Data

Dec 28, 2009

I need to :
Read data from a file. The file contains the location and file name of a file and the name to which I want to save as (about 27,000). Then I need to Open the File with PDF Pro 9 and save as pdf in a specific loaction with the new name. Where to find some samples of reading, parsing and concatenating data and running a program from within a script?

View 8 Replies

Use 'Tab Stops' When Concatenating (say) A Label Text?

Aug 14, 2011

Is it possible to use 'Tab Stops' when you're concatenating (say) a Label text? I know it can be done for a PrintLine statement but I'm, trying without success, to put tabs after the colons in this code. ( "...... :" & vbTab ...)

Label1.Text = "Width margins:" & a.ToString & " Pixels." & vbCrLf
Label1.Text += "Height margins:" & b.ToString & " Pixels" & vbCrLf
Label1.Text += "Top margin:" & c.ToString & " Pixels" & vbCrLf
Label1.Text += "Bottom margin:" & d.ToString & " Pixels" & vbCrLf
Poppa.

View 9 Replies

VS 2008 - Concatenating Text In Textbox?

Feb 14, 2011

I have a textbox "myTextbox" and a listbox "myList" which shows a list of strings e.g "AAA", "BBB", "CCCC".When the user clicks on an item from the listbox the text must be appended to the end of whatever is in myTextbox with a space preceeding it. e.g " AAA".The user must never be allowed to delete the added text.The user must be allowed to manually enter text in the textbox but it must always be in front of the added text. They must never be allowed to type over the added text or after the added text.I have been trying to get my head around this for a day now and cannot figure it out.

View 7 Replies

Import Xlsx File Into Using TransferSpreadsheet When Path Is Constant But Filename Is Variable

Oct 1, 2009

I use the followoing code to import an xlsx file into an Access 2007 table. It works fine when I enter the exact file name.However, part of the file name is a date which will change every week.The file location does not change,just the date in the file name.[code]I've tried using a wildcard but I get a Run-time error 3011.Db engine could not find the object. Make sure the object exists.

View 1 Replies

Combining A String And String Variable Into One Variable

Apr 4, 2009

I am trying to insert a string variable inside of two strings, and make a combined string. Public Sub Page_Load() Dim Id As String Id = Trim (Request.QueryString("Id")) End Sub Dim mp3text as string url... & Id & ".mp3" My goal is to make the mp3text variable have a string that is: url...(If Id is 7) It is for some reason not connecting up correctly. I checked what string it is outputting and this is what it is giving: url...It is missing the Id content.

View 12 Replies

Getting Extra HEX Bytes When Concatenating Data Files?

Aug 8, 2009

I'm concatenating data files, but the problem is that I'm seeing some extra bytes where the files are joined. The new file has extra bytes. I had thought this was maybe a problem with encoding.Here are the methods that I've tried to use to concatenate the files. The first example I'm getting extra 0xA0 0x00 bytes.

Dim inputfiles() As String = Directory.GetFiles(sourcedir, pattern)
Dim bufSize As Integer = 1024 * 64
Dim buf As Byte() = New Byte(bufSize) {}

[code].....

View 4 Replies

VS 2008 Concatenating New Field Makes Everthing Disappear?

Apr 25, 2010

The following works in reading from my SQL Server table:

Dim CMD As New SqlCommand
CMD.Connection = conn
CMD.CommandText = "SELECT tblPersons.id, "
CMD.CommandText = CMD.CommandText & "CASE "

[Code]...

View 2 Replies

Use CType To Change An Object Variable "obj" To Custom Class That Reference Using A String Variable Like Obj.GetType.Name?

Feb 9, 2011

The code below works for the class that I hard coded "XCCustomers" in my RetrieveIDandName method where I use CType. However, I would like to be able to pass in various classes and property names to get the integer and string LIST returned. For example, in my code below, I would like to also pass in "XCEmployees" to my RetrieveIDandName method. I feel so close... I was hoping someone knew how to use CType where I can pass in the class name as a string variable.

Note, all the other examples I have seen and tried fail because we are using Option Strict On which disallows late binding. That is why I need to use CType.I also studied the "Activator.CreateInstance" code examples to try to get the class reference instance by string name but I was unable to get CType to work with that.When I use obj.GetType.Name or obj.GetType.FullName in place of the "XCCustomers" in CType(obj, XCCustomers)(i)I get the error "Type 'obj.GetType.Name' is not defined" or "Type 'obj.GetType.FullName' is not defined"

'+++++++++++++++++++++++++++++++
Imports DataLaasXC.Business
Imports DataLaasXC.Utilities

[code]....

View 2 Replies

Split Comma Separated String In Text File And Save Each String In Different Variable?

Dec 5, 2011

These is the content of my txt file which is saved in D drive in my pc abc,1,2,3..I tried the flowing but it didn't work:[code]I am getting error on this line.. data = line.Split(","c)...it says this line isn't in use anymore or something and that I rather use LineInput but thats asks for filenumber and i don't know what that is. I am sorry but I am a complete beginner. what else can I try? [code]ok that error is gone now but now if I want to add these values to a list box..how can i do that?

View 1 Replies

Concatenating Multiple NonNull Columns Into Combobox Text Property?

May 19, 2010

I'm trying to concatenate nonnull multiple columns from a database into the text property of a combobox. Right now, I'm receiving an "IndexOutOfRangeException was unhandled name, address1, address2". The line, "cboFreight.Text = drFreight("name" & ", " & "address1" & ", " & "address2")" is where the error is occurring. Here is my code for this section:

Dim drFreight As SqlDataReader = cmdCorrespFreight.ExecuteReader
While drFreight.Read()
'If "address3" <> "" Then
If IsDBNull(drFreight("address3")) Then

[code]....

View 2 Replies

Sql Server - Handling Null Strings When Concatenating Select Statement?

Nov 9, 2011

I have this simple-minded query:

select a.str_number+' '+a.str_name+' '+a.str_suffix+' '+a.str_apt AS addr from mytable

This query works as long as none of the concatenated values are not NULL. If any is null, the address does not show.

I tried this:

select IsNULL(a.str_number+' '+a.str_name+' '+a.str_suffix+' '+a.str_apt AS addr,'') from table

What I would like to accomplish is to replace NULL with empty space if the value is null but I still get no values.

View 3 Replies

Sorting - Sort List(of String()) Using A Variable Index Into String() As Key ?

May 30, 2012

I have a List(of String()). I have written a custom comparer (implements IComparer(of string)) to do an alphanumeric sort.Is there a way to sort the List using a given index to determine which position in the String() to sort by? In other words one time I might sort by Index = 0 and another time by Index = 3. The length of all String() in the list is the same.For reference this question is similar to Sort List<String[]> except I am using VB.net and that question is hardwired to Index=0.

EDIT from OP's comments:I started simple with the non custom comparer but I am getting an error: expression does not produce a value. Not sure what I am doing wrong.Here is the code:

Public Shared Function SortListOfStringArray(ByVal ListOfStringArray As List(Of String()), ByVal SortByIndex As Integer) As List(Of String())
Return ListOfStringArray.Sort(Function(x, y) x(SortByIndex).CompareTo(y(SortByIndex)))
End Function

View 1 Replies

Forms :: Concatenating Multiple NonNull Columns Into Combobox Text Property?

May 19, 2010

I'm trying to concatenate nonnull multiple columns from a database into the text property of a combobox. Right now, I'm receiving an "IndexOutOfRangeException was unhandled name, address1, address2". The line in red is where the error is occurring. Here is my code for this section:[code].....

View 1 Replies

Path Of .zip file Has Spaces In It / It's Not Recognizing Path As Valid Path

Aug 22, 2006

I have a Access program and I'm using VBA code in the background to run Winunzip using shell command. Well, the path of the .zip file has spaces in it and it's not recongizing the path as a valid path. Is there a another way to tackle this problem besides the shell?I can't us pkzip either. Has you can see I had to use progra~1 instead of Program Files.[code]

View 2 Replies

When String Variable Was Empty String First One Returns 'nothing'

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







Copyrights 2005-15 www.BigResource.com, All rights reserved