725 Posted Topics
Re: See if this helps. [CODE] Dim dTotal As Double = 0 '// for adding total. For Each itm As ListViewItem In ListView1.Items '// loop thru items. With itm.SubItems(1) '// shorten code for Column 2 items. '// check if Not Nothing, add to total. If Not .Text = Nothing Then dTotal … | |
Re: See if this helps. [B]2 RichTextBoxes, 1 Button[/B] [CODE]Public Class Form1 Private arlRtbLines As New ArrayList '// adds rtb1 lines if string is not found in a line. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim sStringToFind As String = "Rachel Dawkins" '// String to … | |
Re: 1. [B]Add reference to Microsoft HTML Object Library[/B] when working with [ICODE]DomDocument[/ICODE]. .File menu, Project/Add Reference.../COM tab/Microsoft HTML Object Library. 2. Add an import to the top of your Form for [ICODE]mshtml[/ICODE]. [CODE]Imports mshtml '// After adding the reference, Import mshtml. Public Class Form1[/CODE] | |
Re: See if this helps. [CODE] Dim ExpDate As String = CDate(dgvBlock_Extend.Rows(icnt).Cells("Extend Door & Lift Expiry Date").Value).ToString("yyyyMMdd")[/CODE] | |
Re: Place this line of code in your Form's .Load event. [CODE]Control.CheckForIllegalCrossThreadCalls = False '// allow cross threading.[/CODE] | |
Re: See if this helps to load images in a ListView. [CODE]Public Class Form1 '// ImageList used to store images for the ListView. Private myImageList As New ImageList With {.ColorDepth = ColorDepth.Depth32Bit, .ImageSize = New Size(45, 45)} Private myImagesFolder As String = "C:\TEMP" '// Folder containing images. Private Sub Form1_Load(ByVal sender … | |
Re: See if this helps. [CODE] MsgBox(Date.Now.AddDays(90).ToShortDateString) MsgBox(Date.Now.AddDays(-90).ToShortDateString)[/CODE] | |
Re: See if this helps since you probably do not have columns added to your ListView. [CODE] Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load With ListView1 .Columns.Add("Column 1", 100) : .Columns.Add("Column 2", 100) : .Columns.Add("Column 3", 100) '// add Columns, "100" is column.Width. .View = View.Details … | |
Re: See if this helps. [B]2 Buttons, 5 TextBoxes(.Named "txtMenu#")[/B] [CODE]Public Class Form1 Private iSelectedTextBox As Integer = 1 '// keeps track of which TextBox is selected. Private iFirstTextBox As Integer = 1 '// # of first TextBox, as "txtMenu#". Private iLastTextBox As Integer = 5 '// # of last TextBox, … | |
Re: Seems that you are missing your quotations for the .Value. [CODE] Dim iCount As Integer = 0 With DataGridView1 For i As Integer = 0 To .RowCount - 1 '// loop thru all Rows. If .Rows(i).Cells(0).Value = "True" Then iCount += 1 '// check for value and Then only add … | |
Re: See if this helps. [CODE] Dim arDaysOfWeek() As String = {"mon", "tue", "wed", "thr", "fri", "sat", "sun"} '// days of week in "ddd" format. Dim isValidDay As Boolean = False Dim arTemp() As String = Nothing With TextBox1 If .Text.Contains("-"c) Then arTemp = .Text.Split("-"c) For Each myDay As String In … | |
Re: Placing a Label over the DateTimePicker could do the trick. | |
Re: See if this helps. [CODE] Private Sub SaveAsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveAsToolStripMenuItem.Click If Not Me.ActiveMdiChild Is Nothing Then '// check if Form available. MsgBox(Me.ActiveMdiChild.Name) '// get .Name of Active Form. End If End Sub[/CODE] | |
Re: See if [URL="http://www.daniweb.com/forums/post1438157.html#post1438157"]this thread[/URL] helps with extracting data from a website. Should be easy to have the code use HTTP instead of a WebBrowser. | |
Re: I am not really sure since I have never converted a project from vb6 to vb.net, although when loading a Form1.Designer.vb in Notepad++ or Notepad, your image code looks similar to it. Try replacing the first lines of code with these lines. [CODE]<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Partial Class frm_Merge Inherits System.Windows.Forms.Form 'Form … | |
Re: I personally would use a ListView for a "time-in, time-out program". | |
Re: [CODE]Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.KeyPreview = True '// keep focus of keys on Form. End Sub Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown If e.KeyCode = Keys.F2 Then If Button1.Enabled = True Then Button1.Enabled … | |
Re: See if this helps. [CODE] MsgBox(Format(Now.AddMinutes(5), "MM/dd/yyyy hh:mm:ss tt")) MsgBox(Format(Now.AddMinutes(-5), "MM/dd/yyyy hh:mm:ss tt"))[/CODE] | |
Re: See if this helps to get you started with your entries. [CODE]Public Class Form1 Private myAddressBookEntries As New ArrayList '// store your entries. ArrayList is similar to a ListBox. Private arEntry() As String '// String Array to split each entry. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) … | |
Re: See if this helps. [CODE]Public Class Form1 '// your application's folder that contains all Forms. Private myAppFolder As String = "C:\Users\codeorder\Desktop\vb.net\WindowsApplication1\WindowsApplication1" Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim myCoolFileLineCount As Integer = 0 For Each myCoolFile As String In My.Computer.FileSystem.GetFiles _ (myAppFolder, FileIO.SearchOption.SearchTopLevelOnly, "*.*") … | |
Re: [CODE] For Each item As ListViewItem In ListView1.Items If item.Checked = False Then '// check if Not Checked. MsgBox(item.SubItems(1).Text) '// get value of "item" .SubItems(1). End If Next[/CODE] | |
Re: See if this helps. [CODE] Private Sub DataGridView1_RowsAdded(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowsAddedEventArgs) Handles DataGridView1.RowsAdded If DataGridView1.RowCount = 10 Then Button1.Enabled = False End Sub[/CODE] | |
Re: If you were getting the [ICODE][COLOR="Red"]Conversion from type 'Match' to type 'String' is not valid.[/COLOR][/ICODE], you just needed to get the [ICODE].Value of the Match[/ICODE]. [CODE] For Each itemcode As Match In matches ListBox1.Items.Add(itemcode.Value) Next[/CODE] | |
Re: See if this helps. [CODE] With frmCitation.txtPlate If Not .Text = "" Then '// check if TextBox has text. writer.WriteStartElement("VEHICLE_LICENSE_NUMBER") '10-28 writer.WriteString(.Text.ToString) writer.WriteEndElement() End If End With[/CODE] | |
Re: You are getting the error because [iCODE]mydr(9)[/iCODE] is not declared and you probably have it declared as [iCODE]mydr(8)[/iCODE] or less than 8. To check if a ListView .SubItem exists, see if this helps. [CODE] Private Sub ListView1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.Click With ListView1 If Not … | |
Re: See if this helps. [CODE] For x = 0 To 7 If Not score(x) = Nothing Then totalScore += score(x) '// add to totalScore. Next[/CODE] | |
Re: See if this helps. [CODE] With DataGridView2.CurrentRow CheckBox1.CheckState = CType(CInt(.Cells(0).Value), CheckState) CheckBox2.CheckState = CType(CInt(.Cells(1).Value), CheckState) End With[/CODE] .Value of "0" is Checked = False and .Value of "1" is Checked = True. | |
Re: See if this helps to add DropDownItems or Items to a menu. [B]1 MenuStrip(with a "File" menu item)[/B] [CODE]Public Class Form1 Private myCoolFolder As String = "C:\" Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load For Each myFile In My.Computer.FileSystem.GetFiles(myCoolFolder, FileIO.SearchOption.SearchTopLevelOnly, "*.*") '// get files. FileToolStripMenuItem.DropDownItems.Add(myFile) … | |
Re: See if this helps to download all web files from a ListBox. [CODE] Dim myFolder As String = "C:\" '// folder to save files to. Dim sFileExtension As String = Nothing '// string to get the file extension from web file. Dim iFileNameNumber As Integer = 0 '// used to … | |
Re: See if this helps. [B]1 TextBox, 1 Button, 3 Labels[/B] [CODE] Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Select Case TextBox1.Text '// check value in TextBox. Case "5" '// if 5. Label1.Text = "15000" Label2.Text = "15%" Label3.Text = CStr(15000 * 0.1) '// multiply 15000 … | |
Re: See if this helps to get individual values from a CSV file. [CODE]Public Class Form1 Private myFile As String = "C:\test.csv" '// your file. Private arlCSVlines As New ArrayList '// similar to a ListBox. Private arTemp() As String = Nothing '// String Array to .Split each line. Private Sub Form1_Load(ByVal … | |
Re: Why not create a project that will go through the entire database and correct code? CrLf is nothing but a line break, like vbNewLine. See if this helps to catch the CrLf. [CODE] Dim sTemp As String = "some" & vbNewLine & vbNewLine & "text" If sTemp.Contains(CChar(vbCrLf)) Then MsgBox(sTemp) '// … | |
Re: See if this helps. [B]1 Panel, 1 Button, 1 Timer[/B] [CODE]Public Class Form1 Private eX, eY As Integer '// get Cursor location. Private rCursorBounds As New Rectangle(0, 0, 0, 0) '// rectangle used for Collision check. Private BlockY As Integer = 0 '// declared once. Private Sub Form1_MouseMove(ByVal sender As … | |
Re: See if this helps. [CODE]Public Class Form1 Private iImageNumber As Integer = 0 '// for images Index in ImageLists. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load '// set .SizeMode once. PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage PictureBox2.SizeMode = PictureBoxSizeMode.StretchImage setImages() '// set images to PictureBoxes if needed. '// … | |
Re: [B]Eekhoorn[/B], overlooking your original posted code and seeing this, seems that you are trying to get only the file name with extension from a file's full path. [CODE] For Each file In foundFiles [COLOR="Red"] Testlength = file.Count Test = file.LastIndexOf("\") Test1 = Test + 1 FleNmLength = Testlength - Test1 … | |
Re: See if this helps. [CODE] Public Sub SaveCustomerDbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveCustomerDbtn.Click If txtCustomerSurnameOS.Text = "" Then MsgBox("Please Input Surname", MsgBoxStyle.Critical) txtCustomerSurnameOS.Focus() Exit Sub '// Skip remaining code. End If If txtCustomerForenameOS.Text = "" Then MsgBox("Please Input Forename", MsgBoxStyle.Critical) txtCustomerForenameOS.Focus() Exit Sub '// Skip remaining … ![]() | |
Re: See if this helps. [CODE] Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If RadioButton1.Checked Then MsgBox("RadioButton1 is Checked.") If RadioButton2.Checked Then MsgBox("RadioButton2 is Checked.") End Sub[/CODE] | |
Re: See if this helps. Add a Public String in Form2 to store the language selected and add a Parameter to the Function. [B]Form2[/B] [CODE] Public sLanguageSelected As String Private Sub PlayFlash(ByVal selectedCurrentLanguage As String) FlashObj.Stop() If selectedCurrentLanguage = "LANG_MALAY" Then FlashObj.Movie = MultimediaPath & "\Ezy1-agency-Bahasa.swf" ElseIf selectedCurrentLanguage = "LANG_ENG" Then … | |
Re: See if this helps. [CODE]Public Class Form1 Private myItemPrices() As Double = {4.95, 6.87, 8.52, 2.99, 0.71, 0.5, 0.99} '// item Prices. Private myTax As Double = 0.06 '// Tax used to add to Total Price. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load With ListBox1.Items … | |
Re: Also, see if this helps. [CODE]Public Class Form1 Public topping1, topping2, drink As String '// Global declared Strings. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load '// set values to your Strings. '//-- if needed to set from other Forms, use: Form1.topping1="topping here", etc. topping1 = … | |
Re: See if this helps to remove certain lines from a TextBox. [CODE]Public Class Form1 Private arTemp() As String = Nothing '// used to get all lines from TextBox. Private sTemp As String = Nothing '// used to add lines back to TextBox. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e … | |
Re: [CODE] Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress Select Case e.KeyChar Case "1"c, "2"c, "3"c, "4"c, "5"c, "6"c, "7"c, "8"c, "9"c, "0"c, CChar(vbBack) '// your #'s and Backspace. e.Handled = False '// allow. Case "."c '// Decimal dot. allow only one. If Not TextBox1.Text.Contains(".") Then … | |
Re: Not really sure since I have not uploaded anything to FTP with vb.net, but could you just not use: [CODE] Dim file() As Byte = System.IO.File.ReadAllBytes("c:\mybackups.zip") Dim file2() As Byte = System.IO.File.ReadAllBytes("c:\mybackups2.zip") Dim file3() As Byte = System.IO.File.ReadAllBytes("c:\mybackups3.zip") Dim strz As System.IO.Stream = request.GetRequestStream() strz.Write(file, 0, file.Length) strz.Write(file2, 0, file.Length) … | |
Re: Check out [URL="http://www.daniweb.com/software-development/vbnet/threads/312128/1335997#post1335997"]this link[/URL]. | |
Re: Since your [iCODE]Dim index As Integer[/iCODE] has no value when the application loads, it is set by default to 0. .This means that any control array that uses (index), only declares one control. You have to [ICODE]ReDim[/ICODE] the control array for the Index not to be outside the bounds of … | |
| |
![]() | Re: Post code that saves and loads from/to your RichTextBox. AndAlso, if a TextBox loads .rtf text, then add that code as well. |
Re: See if this helps for locating only the checked items in a ListView. [CODE] For Each itm As ListViewItem In ListView1.CheckedItems MsgBox(itm.Text) Next[/CODE] Or you could use the _ItemChecked event to locate the currently checked item. [CODE] Private Sub ListView1_ItemChecked(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemCheckedEventArgs) Handles ListView1.ItemChecked If … | |
Re: What exactly are you trying to do? .Load file, modify certain lines, and save file back? | |
Re: See if this helps. [CODE] Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress Select Case e.KeyChar Case "1"c, "2"c, "3"c, "4"c, "5"c, "6"c, "7"c, "8"c, "9"c, "0"c, CChar(vbBack) '// your #'s and Backspace. e.Handled = False '// allow. Case "."c '// Decimal dot. allow only one. … |
The End.