dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Checkboxs as text filter

  1. #1
    Join Date
    Mar 2019
    Posts
    1

    Checkboxs as text filter

    Vb 2015
    I trying to make some text filters whit checkbox
    My program read text files and sort the events line by line, but i want to hide sertain lines whit text if i uncheck the checkbox.
    There is multible checkbox`s box1 hide line whit aaa
    box2 bbb etc

    Code:
    Imports System.IO
    Public Class MainForm
        Private Sub RadioButton5_CheckedChanged(sender As Object, e As EventArgs)
    
        End Sub
    
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    
        End Sub
    
        Private Sub AvsluttToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AvsluttToolStripMenuItem.Click
            End
        End Sub
    
        Private Sub OmToolStripMenuItem_Click(ByVal sender As Object, e As EventArgs) Handles OmToolStripMenuItem.Click
            Dim NewForm As New About
            NewForm.Show()
        End Sub
    
        Private Sub HelpToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles HelpToolStripMenuItem.Click
            Dim Newform As New Changelog
            Newform.Show()
        End Sub
    
        Private Sub PrintToolStripMenuItem_Click(sender As Object, e As EventArgs)
    
        End Sub
    
        Private Sub ┼pneToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ┼pneToolStripMenuItem.Click
            If (┼pneFil.ShowDialog = DialogResult.OK) Then
                RichTextBox.Text = My.Computer.FileSystem.ReadAllText(┼pneFil.FileName)
            End If
    
        End Sub
    
        Private Sub RichTextBox_TextChanged(sender As Object, e As EventArgs) Handles RichTextBox.TextChanged
    
        End Sub
    
        Private Sub Button_Click(sender As Object, e As EventArgs) Handles VelgFil.Click
            If (┼pneFil.ShowDialog = DialogResult.OK) Then
                RichTextBox.Text = My.Computer.FileSystem.ReadAllText(┼pneFil.FileName)
                RichTextBox.Text = Trim(RichTextBox.Text.Replace(vbLf, "").Replace(vbCr, " "))
                RichTextBox.Text = Trim(RichTextBox.Text.Replace("---", vbLf))
                Dim richtxt As String = RichTextBox.Text
                Dim pos As Integer = richtxt.IndexOf(vbCr)
                RichTextBox.Text = richtxt.Substring(pos + 1, richtxt.Length - pos - 1)
            End If
        End Sub
    
        Private Sub OpenFileDialog1_FileOk(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles ┼pneFil.FileOk
            Filebane.Text = ┼pneFil.FileName
        End Sub
    
        Private Sub Filebane_TextChanged(sender As Object, e As EventArgs) Handles Filebane.TextChanged
    
        End Sub
    
        Private Sub ExportToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ExportToolStripMenuItem.Click
            LagreFil.ShowDialog()
    
        End Sub
    
        Private Sub Menyer_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) Handles Menyer.ItemClicked
    
        End Sub
    
        Private Sub BindingSource1_CurrentChanged(sender As Object, e As EventArgs)
    
        End Sub
    
        Private Sub LagreFil_FileOk(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles LagreFil.FileOk
            Dim ExportNavn As String = LagreFil.FileName
            Dim objektwriter As New System.IO.StreamWriter(ExportNavn)
            objektwriter.Write(RichTextBox.Text)
            objektwriter.Close()
    
        End Sub
    
        Private Sub OptionToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles OptionToolStripMenuItem.Click
            Dim NewForm As New Innstillinger
            NewForm.Show()
        End Sub
    
        Private Sub SkrivUtToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SkrivUtToolStripMenuItem.Click
            SkrivUt.ShowDialog()
        End Sub
    
        Private Sub CheckBox5_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox5.CheckedChanged
     
    
        End Sub
    
    End Class

  2. #2
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,319

    Re: Checkboxs as text filter

    Well if you were to read the file line by line when placing it into the text box it would be fairly simple to omit the lines you do not want to show but you are adding them all at once so that means you would need to go through them and remove the ones you do not want to show.

    I have not used the rich text box in VB.Net so not sure if it supports a method to reference a specific line and remove it or not. Probably does but I have not looked to see for sure
    Always use [code][/code] tags when posting code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)