
Bucky
*Experts*
-
Posts
803 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by Bucky
-
Inside the repeater control, create a LinkButton control that has the CommandArgument and CommandName attributes set depending on the panel you want to show and hide. Then, when this LinkButton is clicked, the ItemCommand event of the Repeater control is fired. It's in this event handler that you can change the visibility of the panel.
-
It should install right over it. If I remember correctly, that's what I did.
-
It sounds like you need to use Response.Write().
-
Yeah. The static Process.Start() method returns a Process object, which has a WaitForExit() method (how handy!). Dim p As System.Diagnostics.Process p = System.Diagnostics.Process.Start("C:\mySetup.msi") p.WaitForExit()
-
The NetworkStream class inherits from the base Stream class. This means that a NetworkStream has all the members of the Stream class, but it impliments them differently and it may have more members specialized to network communication. It is best to use the most specific object when this situation occurs, so stick to the NetworkStream.
-
To prevent this exception from being thrown in the first place, check to see if the object is equal to a null reference (Nothing) before using it. If MyObject Is Nothing Then ' The object wasn't initialized Else ' The object can be used End If
-
Eek, don't use Shell... that's one of the old VB6 functions. Use System.Diagnostics.Process.Start("C:\mySetup.msi") But, if the error says the file is not found, then chances are you're passing an incorrect filename.
-
You need to resize the myarray before you can add stuff to it. It'd be much easier to just use an ArrayList, or, even more specialized, a StringCollection: Dim checkedValues As New System.Collections.Specialized.StringCollection() Dim item As ListViewItem ' You don't need the new keyword here Dim checklist As ListView.CheckedListViewItemCollection = filelistview.CheckedItems For Each item In checklist checkedValues.Add(item.SubItems(2).Text) Debug.WriteLine(checkedValues(checkedValues.Length - 1) & " -- " & checkedValues.Length - 1 Next
-
Instead of using a For loop in which you define the starting and ending values, use a Do loop which you can exit whenever you want. However, you can only resize the last dimension of a multidimensional array, so you could not resize the array here to fit the number of lines in your file. I suggest you look at using either an [mshelp=ms-help://MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemcollectionsarraylistclasstopic.htm]ArrayList[/mshelp] that contains a collection of [mshelp=ms-help://MS.MSDNQTR.2003FEB.1033/vblr7/html/vastmStructure.htm]Structures[/mshelp] to store your data, or dynamically creating a [mshelp=ms-help://MS.MSDNQTR.2003FEB.1033/cpguide/html/cpcontheadonetdataset.htm]DataSet[/mshelp] to store the data. This fits your scenario much better.
-
read file while in use by another program
Bucky
replied to sp0n9e's topic in Directory / File IO / Registry
I do not know the solution... maybe someone else can help you from here. -
Sure! Dim data As New DataSet() Dim table As New DataTable() ' Add the columns With table.Columns .Add(New DataColumn("Index")) .Add(New DataColumn("Value 1")) .Add(New DataColumn("Value 2")) .Add(New DataColumn("Value 3")) End With ' Add the table to the dataset data.Tables.Add(table) ' Get the row and set the values Dim row As DataRow = table.NewRow() row(0) = "Robot1" row(1) = "x" row(2) = "y" row(3) = "z" table.Rows.Add(row) And there you have it. Simple, eh? [mshelp=ms-help://MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconcreatingusingdatasets.htm]Read more![/mshelp]
-
read file while in use by another program
Bucky
replied to sp0n9e's topic in Directory / File IO / Registry
What is the service creating the log file? Is it something you have written and can modify? -
I thought I'd dig up this thread to point out that some legacy VB6 keywords are still highlighted, such as Read and *shudder* Line: Read Line
-
Arrays in VB.NET have, by default, a starting index of 0. This means that your array declaration will actually be array(9, 2). Now, the code to split up the line into multiple parts... you want to use System.Text.RegularExpressions.RegEx.Split (catchy name, huh?): Dim myArray(9, 2) As String Dim x As Integer Dim Read As New System.IO.StreamReader("test.txt") For x = 0 To 9 ' Loop ten times Dim line As String = Read.ReadLine() ' Read the line Dim values() = System.Text.RegularExpressions.RegEx.Split(line, ControlChars.Tab) ' Split up the line myArray(x, 0) = values(0) myArray(x, 1) = values(1) myArray(x, 2) = values(2) Next x
-
[mshelp=ms-help://MS.MSDNQTR.2003FEB.1033/vbcn7/html/vaconCallingWindowsAPIs.htm]Seek, and you shall find[/mshelp]
-
If you're going to store information in a table, it makes much more sense to use an instance of a [mshelp=ms-help://MS.MSDNQTR.2003FEB.1033/vbcon/html/vboriDatasets.htm]DataSet[/mshelp] or a [mshelp=ms-help://MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconworkingwithtypeddataset.htm]strongly-typed DataSet[/mshelp] to store your data. Then it's a piece of cake to display in a DataGrid (or any other data control); just set the DataSource and DataMember properties and call DataBind(). Plus, you can easily serialize the data into an XML file to save your settings.
-
read file while in use by another program
Bucky
replied to sp0n9e's topic in Directory / File IO / Registry
I believe that error message is a little misleading... it sounds more like your own process has opened the file and hasn't closed the stream yet. Do you have any code before the program actually reads the file that might be accessing the file's contents or properties, or something that writes to that file? -
Datagrid question from query statement
Bucky
replied to dakota97's topic in Database / XML / Reporting
Read up on the [mshelp=ms-help://MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemdataoledboledbdataadapterclasstopic.htm]OleDbDataAdapter class[/mshelp]; it does just what you're looking for. -
C++ speed is not consistant and C# is. Why?
Bucky
replied to aewarnick's topic in Interoperation / Office Integration
Actually, this makes a lot of sense. In C#, the code is compiled every time before execution, so the only speed hit you will see in the IDE versus outside the IDE is in the fact that the debugger is attached to the app. Now I'm not sure how VC++ works in terms of debugging, but it sounds like it's doing something slow while debugging. In any case, the final compiled app will always be somewhat faster than its debugged counterpart, and you do not necessarily need to worry about the speed of your app if it's slow in the IDE. -
Depending on what's stored in the ArrayList, the code will be different for casting each object and getting the text to put into the textbox. The following code will always work, but it may not work the way you want if the objects in the ArrayList are not types that convert to a user-friendly string in the ToString function. foreach (object o in ArrayList1) { TextBox1.Text += o.ToString() + System.Environment.NewLine; }
-
The method of handling events is much more robust than this in C# and other .NET languages. I suggest you read up on [mshelp=ms-help://MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconevents.htm]events and delegates[/mshelp].
-
Any code-behind pages or any code in code blocks in an ASPX page that's not in the HTML itself are compiled into a DLL which is what's called at runtime. When you upload files to a server, you only need to include the DLL(s) and the ASPX pages; you do not need to upload the code-behind pages. Does that answer your question?
-
Function delegate from a procedure address
Bucky
replied to Bucky
's topic in Interoperation / Office Integration
Oooh, good idea... unfortunately it didn't work. An error was thrown: "System.ArgumentException - Function pointer was not created by a Delegate." So it looks like it's closer than before... -
I've been trying to replicate some C++ code in VB.NET. The C++ code gets a function address by using GetProcAddress, then casts that into a delegate that then calls a callback function in the code. So far I can correctly get the procedure address into an IntPtr variable, but now I'm trying to create an instance of a function delegate based on this address. DirectCast won't take a value type (the procedure address) as a first parameter, so how else might I cast it? The solution may lie in the Marshal object, but I cannot find it. Here's the C++ code: // Here's the delegate declaration typedef ULONG (*GetAttachedDevicesProc) (ULONG* pDeviceCount, PTCHAR pBuffer, ULONG* pBufferSize); // And the instance of that delegate static GetAttachedDevicesProc gGetAttachedDevices; // This is the tricky part, it casts the proc address to an actual delegate gGetAttachedDevices = (GetAttachedDevicesProc) ::GetProcAddress (fgUSBLib, "PalmUsbGetAttachedDevices") And the VB.NET code I have so far: ' The delegate: Private Delegate Function GetAttachedDevicesDelegate(ByVal deviceCount As Integer, ByVal buffer As String, ByVal bufferSize As Integer) As Integer ' Getting the procedure address: procAddress = New IntPtr(GetProcAddress(moduleHandle.ToInt32(), "PalmUsbGetAttachedDevices")) ' Now how do I make a new instance of GetAttachedDevicesDelegate based on the address?
-
Dim item As Object For Each item In LeftListBox.SelectedItems LeftListBox.Items.Remove(item) Next