Declaration String Does Not Work
Aug 23, 2010I need to Dim lblFilePath. As what do I Dim it, String dos not work. This might not makes sence to you,
[Code]....
I need to Dim lblFilePath. As what do I Dim it, String dos not work. This might not makes sence to you,
[Code]....
I'm making a call to my DLL file (prototyping 30+ functions), and want to be able to switch between different versions of the DLL quickly while in development. Thus, i want to replace the literal string constant that follows the "Lib" key word, with a variable string constant. In case there's any confusion in my use of the jargon. I am currently able to do this:
[Code]...
I am using VB.NET 2003 and declared a string array as follows:
Dim Level(1500) As String
The program stops at 1000 when it is executing. Is there a maximum limit? Should compile or ling different?
I got problem regarding declaration of dynamic runtime array declaration Here is my code
[Code]...
I have been working on an activeX control which works on serial port communication. Now I have completed the project and created its setup.exe using Visual studio 6 -> Tools -> Package and Deployment Wizard. Then I installed the control in another PC and in a new project included the control using project -> components. But when I click on the control in the toolbox and then include on the form it gives the following error : delete current link ? and on clicking OK, nothing happens. I tried searching a lot on google but didnt find anything. Another problem is that I have created a string array as a global array which can be accessed by all the methods.I am able to include the same activex control in my own pc when I have created the project. Here it works fine, I am able to access all the methods that I coded in the control, but the String array mentioned above can be accessed in other project. I tried writing Public before the array declaration but it give me the compile error : "Constants. fixed length strings, arrays, user defined types and Declare statements not allowed as Public members of object module." [code]
View 1 RepliesAfter having some trouble in my own code using String.Split and the Split(String(), Int32, StringSplitOptions) overload, I decided to look to the MSDN.I copied the entire VB.NET code example from this link: url...I placed it in a new class, and received the following errors (same errors as my own code example):[code]Why can my code not recogognize the string() parameter overloads to String.Split? Remember, i took the code from the MSDN link above, copied and pasted and it still did not work.I am counting on using the string() instead of char() overloads shown here: url...
View 15 RepliesI have following code snippet that is supposed to replace the existing text in a local text file but instead it's just appending the new values on top of the file and pushes the older text down.
Here is the code:
dim sr as streamreader = file.opentext(path)
dim contents as string = sr.Readtoend()
sr.close()
Dim sw as streamwriter = file.Createtext(Path)
sw.Write(contents.replace("old value1", "new value")
sw.Write(contents.replace("old value2", string.empty)
sw.close()
What do I need to change to make it replace existing text rather than append?
this piece of code works fine....
Private Sub save()
Dim con As New SqlClient.SqlConnection("Data Source=.SQLEXPRESS;AttachDbFilename=D:Chuttu VBProjectsLICLIC.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True")[code]......
NOTE: I get no errors.
I need to check if a label starts with a certain text, but it wont work!Here is the code I have:
Dim str1 As String = Label1.Text
Dim value As String = "abc123"
If str1.StartsWith(value) Then
'do something
end if
May I also add that the label i'm checking (the text inside it) has no spaces, i don't know if that makes any difference.
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?
I am using an INSERT INTO statement and one of my database variables is a varchar(51). Can a string be directly stored as a varchar or do I need to convert this to something else beforehand?
View 1 RepliesI currently have the following GridView TemplateField:
[Code]...
I have two connection strings coded and in their different contexts, they both work in VB.Net 2008. However, the third connection string will not work if it has the extra ;HDR=Yes;IMEX=1 so I wonder why. Is it perhaps the words 'Extended Properties' in the third example that makes it fail?
[Code]....
Private Sub MDIForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DateLbl.Text = System.DateTime.Now
End Sub
i used this code to show date and time in the status strip but time stands still how do i make it run ????
Basically i have a query string that when i hardcode in the catalogue value its fine. when I try adding it via a variable it just doesn't pick it up.This works:
Dim WaspConnection As New SqlConnection("Data Source=JURA;Initial Catalog=WaspTrackAsset_NROI;User id=" & ConfigurationManager.AppSettings("WASPDBUserName") & ";Password='" & ConfigurationManager.AppSettings("WASPDBPassword").ToString & "';")
This doesn't:
Public Sub GetWASPAcr()
connection.Open()
Dim dt As New DataTable()
Dim username As String = HttpContext.Current.User.Identity.Name
[code]....
When I debug the catalog is empty in the query string but the WASP variable holds the value "WaspTrackAsset_NROI"
My application uses a third party API. This API uses a few functions that returns a value by reference as one of the function parameters. Problem is according to their documentation, the value I am trying to get out of this function is a string pointer.
So if that made no sense, heres an example of the syntax of the function as shown in their documentation:
long ExampleFunction(long ID, long PropNum, char* name, long MaxStringLength)
Input Parameters: ID, PropNum
Output Parameters: name, MaxStringLength
Thats pretty much all the info I've got. Obviously they are not using VB.Net, looks like C to me. I want to get the name output parameter and work with it, but once I get this value, I cant change anything. I know this is because its a pointer (reference type?) but I am still at a loss as to what to do.
[code]Myself and a coworker have stared at this quite a lot and we can't figure out why it's not working. The problem is in the value for @ID (since it still works when I leave the other one parameterized). The funny thing is, Just a few lines of code above it I have a different query that sets a parameterized value for the same ID, using the the same choices list that the For Each loop is getting the match variable from.Choices is a list of longs, and when I use choices(0) to parameterize ID in a query, it works. But now down here in this loop I have the new match long, and it doesn't want to make it work for me.
View 1 RepliesI use ODBC connection for my application (controlpanel -> administrativetools -> odbc -> DSN) to sql server 2008, and windows authentication
it works perfect on windows xp,but now I run it on windows7 and sql server 2008 with sql server authentication.when I make the DSN and query the connection its ok and I got this message (TESTS COMPLETED SUCCESSFULLY!)but when I run the application I got this error (ERROR [28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user ''. ERROR [28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user ''.) I think a little more and I found that Maybe my password doesn't save for my user, when I make that DSN?
why the rowfilter property does not work if there is an apostrophe in present in the string. For e.g. , tempdat.DefaultView.RowFilter = "Mystring = '" & st & "'" the above does not work if st="mystrings's" under the column header Mystring.
View 3 RepliesI have a text box called TxtSearch on my form. The value entered should always be numeric before the search can be done if its any other data type the following Message box is give - Only a numeric value is allowed in this field", MsgBoxStyle.Information, "GCPM.. (Code shown below)
Private Sub TxtSearch_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TxtSearch.KeyPress
If Char.IsDigit(e.KeyChar) = False And Char.IsControl(e.KeyChar) = False Then[code].....
Now, when you copy and paste a String value on the textbox - TxtSearch the KeyPress doesn't work. The TxtSearch doesn't prompt the message and when you click the Search Button the application crashes - dsiplaying an error converting data type varchar to numeric.. What I want to do is if someone uses the copy and paste tool to enter the value in the textbox- TXTSearch and there is a datatype not numeric the message prompt is called ..
How can rightfully declare these in VB.net , in my coding it's highligted errors on these declaration.
Dim excel As New Microsoft.Office.Interop.Excel.ApplicationClass
Dim wBook As Microsoft.Office.Interop.Excel.Workbook
Dim wSheet As Microsoft.Office.Interop.Excel.Worksheet
I am currently working on VB. I am using Visual Studio 2008.
The piece of code below is a console application which builds without any error.
Imports System.Net
Module Module1
Public Sub Main()
[Code]....
I was told to use this to specify a folder that I want my node to go to.
(Declaration)
<ComVisibleAttribute(True)>
Public Enumeration SpecialFolder
(Usage)
Dim instance As Environment.SpecialFolder
In this
Dim [end] As Point = e.Location
what is the significance of the [] 's?
What is the appropriate declaration such as "ValueChanged" or "Click" for a NumericUpDown that will execute the code when I press enter. I already know that setting the "AcceptButton" property of the main form to a default button will not work, especially if I want a different button to be selected depending on which control I give focus.
PS: Is the syntax any different from Visual Basic 2010 Express than it is on Visual Studio 2012 RC (running in Visual Basic Mode)?
This is some homework material[code]...
View 9 RepliesQuestion: How to shorten this array creation ? I need to create an array of type ReportingService2005_WebService.Property with one property.
Something like:
Dim PropertyArray() as new ReportingService2005_WebService.Property(1)
I have to do this:
Dim PropertyArray As ReportingService2005_WebService.Property() = New ReportingService2005_WebService.Property(0) {}
PropertyArray(0) = New ReportingService2005_WebService.Property
[Code].....
For some reason when i declare an array and set it to a certain amount of elements then under it specify the elements it works in VB 2005 but when i do it in VB 2008 it get : "declaration expected " and i get words underlined.
Public Class Form1
Dim words(20) As String
words(1)="Computer"
End Class
Let me know how to do this in 2008!
Currency Declaration in vb2008.
View 2 RepliesThere's error in the codes below: but I can't see what caused the error
View 4 Replies