419 Posted Topics
Re: The problem is caused by: ListBox1.Items.RemoveAt(ListBox1.SelectedIndex) When you remove the item, there is nothing selected and SelectedIndex = -1. That explains the error, but I have a feeling that your program logic may not be correct. Is the listbox used to select the meals or is it selected by the … | |
Re: Another option is to use the Linq extensions on the array class. For example: Dim A() As String = {"a", "b", "c", "d", "e"} Dim B() As String = {"a", "g", "c", "h", "k"} Dim InA_notIn_B() As String = A.Except(B).ToArray 'yields: b, d, e Dim InB_notIn_A() As String = B.Except(A).ToArray … | |
Re: Guys, this has nothing to do with nulls being returned from the database. It has to to do with the DataTable.Compute method returning a DBNull.Value when as the OP stated that the filter criteria does not match any records in the datatable. Replace the textbox.text assigment statement with: Dim o … | |
Re: Sean, Before I even attempt to offer advice on this I want to make sure we have the goals well defined. So here is how I have distilled your description. Form1 contains: datagridview Form2 contains: multiple textboxes and a "Send Button" On clicking "Send", the contents of the textboxes are … | |
Re: Most of your needs are pretty straight forward. The adding a button one is the stickler. I've hosted other apps in a winform before, so I thought why not follow the same method to host a winform button in another app? It sort of works ok. You need to control … | |
Re: Isn't the correct syntax: System.IO.File.AppendAllText(filepath, strToAppend) not: System.IO.File.AppendAllText(strToAppend)? | |
Re: > When the database doesn't have a password, it works perfectly. But when I give it a password ("OpenSesame") and change the Connect string to "Access;pwd=OpenSesame", I get this error: > "Couldn't find installable ISAM." I am probably wrong on this, but shouldn't the connection string be: "dns=Access;pwd=OpenSesame"? | |
Re: > As a matter of interest, do you know if there is a way to do a similar query on a dataset using LINQ? You would have to run Linq against the DataTable.Rows collection. You could also use the DataTable.Compute method for a non-Linq solution. Dim dt As New DataTable … | |
![]() | Re: Assuming that the datagridview is bound to a datatable, then you can use the DataTable.Compute method. `Dim total As Decimal = CDec(dt.Compute("Sum([Payments])", "True"))` Where "dt" is the name of the datatable. I assumed that the column name in the datatable for "paymenents" is "Paymenents". |
Re: Assuming this is the code that you are using to write the file (found in your other thread), Private Sub WriteAccounts(filename As String, Accounts As List(Of Account)) Dim lines As String = "" For Each acct As Account In Accounts lines &= acct.ToString() & vbCrLf Next System.IO.File.WriteAllText(filename, lines) End Sub … | |
Re: Add this to your code right after the "CopyFromScreen". Cursor.Current.Draw(GraphX, New Rectangle(Point.Subtract(Cursor.Position, New Size(Cursor.Current.HotSpot.X, Cursor.Current.HotSpot.Y)), Cursor.Current.Size)) I hope that you are calling Dispose on GraphX when you are done with it. | |
Re: Put the controls you are enabling/disabling in a container control (panel or group) if possible. Then just enable or disable that one. The child controls will be enabled/disabled as well. | |
Re: This sounds like a case of fat fingers while playing a video game causing. ;)> Yes, you can block the Windows Key via an application. It requires you to do a low level keyboard hook via the windows API's. Imports System.Runtime.InteropServices Public Class Form1 'Choose either while running or while … | |
Re: > The problem I'm having with the latest implementation is this: when saving a file in a local folder, about four extensionless files are created before finally saving the Excel document. You may find this article to educational on this issue. [Click Here](http://support.microsoft.com/kb/814068 "Description of the way that Excel saves … | |
Re: Are you sure that sorting based on N#### is really the best logic? In your sample file, there appears to be condition statements defined after the N####. i.e. > N1040 IF (LAST_TOOL <> 0) > N1050 WHEN TRUE DO $R21=1 > N1060 T1=LAST_TOOL > N1070 GOTOF (<<"T_"<<LAST_TOOL) > N1080 ENDIF … | |
Re: The WebBrowser control uses the installed IE. The problem is that IE8 and above will default to IE7 standards mode. To enable the newer standards, you need to make a registry entry for you specific application executable. See: [Click Here](http://blogs.msdn.com/b/ie/archive/2009/03/10/more-ie8-extensibility-improvements.aspx) [Click Here](http://www.west-wind.com/weblog/posts/2011/May/21/Web-Browser-Control-Specifying-the-IE-Version) | |
Re: What type of database are you using? You indicate the SQL Date type; to me this implies possibly a MySQL DB. If it is a MS SQL Server DB, the type is probably a datetime type. If this is the case then your data may contain a time component that … | |
Re: Hi Jim, If I'm understanding your problem correctly, I think what you want is a message prefilter. These filters are added to the application and filter all application messages. By combining WM_MOUSEMOVE and WM_MOUSELEAVE with a hit test on the clientrectangle you can achieve this. Public Class Form1 Implements IMessageFilter … | |
Re: could you also show the code where you retrieve the blob and fill imagedata? | |
Re: Hi kRod, In terms of speed the Linq method will be the slowest as it will search against every record in the list. If you use Redgate's Reflector to inspect the code that executes for the other three methods, you find that at the end of the call tree that … | |
Re: Hi Toomutch, Is there a specific reason for wanting the distance from the edge as a percentage of the form size? If you can accept having the sides at a constant distance from the edge, you can use the Control.Anchor property to achieve this. For the case of your datagridview, … | |
Re: I would do the changes on the CellValueChanged event. For this example, I have assumed that there is a datagridview column named "Column3" and that you are testing against an integer value. Make changes to column name and field type as necessary to match your data. Private Sub DataGridView1_CellValueChanged(ByVal sender … | |
Re: The SQL date functions will pull the date from the computer acting as the DB server. It ***may not*** be appropriate to use the server's date for the comparison unless it is also used to set the transaction date field. | |
Re: Is there a specific reason for developing in such an outdated version of VB? If you could update to more recent VB version, you could make use of the My.Application.OpenForms collection. I believe the My namespace became available in VB2005. | |
Re: Is it possible that the data type for both qtyinstock and critical are string (nvarchar)? That would explain the results. If it is then perhaps this will work: ` select ProductCode, ProductName, qtyinstock, critical from product where Cast(qtyinstock AS int) <= Cast(critical as int)` | |
Re: Hi, I have added a converter from string to Matrix to your Matrix class. I have also modified your code a bit so that it can run. You Matrix.ToString method returns a multi-line string, so make sure that the textboxes are multiline and big enough to see three lines. The … | |
Re: I have no idea what is causing your issue, but this VBA code works fine for me from Excel. Private Declare Function SetEnvironmentVariable Lib "kernel32" Alias "SetEnvironmentVariableA" _ (ByVal lpName As String, ByVal lpValue As String) _ As Long Sub test() Dim env As Long env = SetEnvironmentVariable("somethingnew", "Hello") Dim … | |
Re: If you have your heart set on gray, then maybe this? Dim bc As Color = Me.BackColor Me.BackColor = Color.LightGray Form2.ShowDialog() Me.BackColor = bc Or if you just want to dull the current backcolor up a bit Dim bc As Color = Me.BackColor Dim DullFactor As Single = 0.25 'Roange … | |
Re: Assuming that you intended to replace the text in the textbox with the trimmed text, Dim index As Int32 Dim trimmedtext As New System.Text.StringBuilder(TextBox1.Text.Length) For i As Int32 = 0 To TextBox1.Lines.Length - 1 index = TextBox1.Lines(i).IndexOf("@") If index <> -1 Then 'add trimmed line characters trimmedtext.Append(TextBox1.Lines(i), 0, index) Else … |