通过datagridview中的某些字符串过滤richtextbox中的数据 [英] Filtering data in richtextbox by some strings from datagridview
问题描述
大家好,
我需要一些帮助,通过DataGridView中的一些字符串过滤RichTextBox中的数据。
我有一份关于所有当前使用的网络许可证的报告一个软件,所以我需要检查所有使用许可证的用户是否是我的同事。我已经创建了同事机器的msaccess数据库,现在我想过滤报告。如果报表内容中的用户已经在DataGridView列Machines中,则将其颜色设置为绿色,将所有其他颜色设置为红色。
计算机的所有名称中间都有字符串@,所以我想使用该字符串来过滤价值。
例如粘贴的报告是:
https://s26.postimg.org /ilh92zwu1/report_content.png
这是我的表格:
https://s26.postimg.org/673nu5k3d/form.png
这是我的期望:
https://s26.postimg.org/5iutb7ldl/after_filetring.png
非常感谢任何帮助。
我的尝试:
Hello to all,
I need a help with filtering data in RichTextBox by some strings from DataGridView.
I have an report of the all currently used network licenses of an software, so I need to check are the all of the users who used the license my colleagues or not. I have created msaccess database of the machines of my colleagues and now I want to filter report. If the user in the report content is already in the DataGridView column "Machines" then color it as green and all other color as red.
All names of the machines has string "@" in the middle so I would like to use that string to filter value.
For example pasted report is:
https://s26.postimg.org/ilh92zwu1/report_content.png
Here is my form:
https://s26.postimg.org/673nu5k3d/form.png
Here is what I expect:
https://s26.postimg.org/5iutb7ldl/after_filetring.png
Any help is very appreciated.
What I have tried:
Private getnumber As String = "@"
Private Sub RichTextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles RichTextBox1.TextChanged
For Each row As DataGridViewRow In DataGridView1.Rows
Dim filteredText As String = row.Cells(2).Value
For Each m As Match In Regex.Matches(RichTextBox1.Text, getnumber)
'what?
Next
Next
End Sub
推荐答案
这是一个分步视频,将向您展示如何开始: VB.NET - 如何在RichTextBox中搜索和选择文本使用Visual Basic .Net [含源代码] - YouTube [ ^ ]
Here is a step-by-step video that will show you how to get started: VB.NET - How To Search And Select Text In RichTextBox Using Visual Basic .Net [with source code] - YouTube[^]
这篇关于通过datagridview中的某些字符串过滤richtextbox中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!