需要在文本框中制作listivew显示数据 [英] Need to make listivew show data in textbox

查看:107
本文介绍了需要在文本框中制作listivew显示数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我正在编写代码片段管理器,我将使用listview控件来存储所有不同的编程语言,以及然后在主语言下有不同的代码片段可以使用。因此,例如,如果主编程语言是C#,它将是这样的:



C#

保存文件

打开文件

C ++

保存文件

打开文件



即只是一个例子,但这就是我希望它发生的事情。我的问题是,如何在列表视图中创建一个项目,使其看起来像那样?我无法在任何地方找到答案,我之前从未使用过listview!我的另一个问题是,如何将代码片段与标题存储在一起,以便它显示出来?我还想添加一个功能,用户可以在其中添加自己的代码片段。但我也不确定。



有没有其他方法可以以同样的方式工作?我想让它连接到一个数据库,所以如果一个人添加了片段,其他人也可以看到它。或者,如果用户不希望这样,那么它将是个人的。任何类型的帮助都会有所帮助。我在.NET 4.0上使用C#WinForms。



谢谢大家!

hey everyone,

I am working on a code snippet manager, and I am going to use a listview control to store all of the different programming languages, and then under the main language have different code snippets that can be used. So for example if the main programming language is C# it would be like this:

C#
Save File
Open File
C++
Save File
Open File

That is just an example, but that is what I want it to happen. My question is, how do I make an item in a listview which would make it look like that? I can't find the answer anywhere and I have never used a listview before! My other question is, how would I store the code snippet with the title so that it shows up like that? I also want to add a functionality where the user can add their own code snippet to it. But I am unsure of that too.

Is there any other way of doing this that would work the same way? I want it to all connect to a database, so if one person adds the snippet other people can see it as well. Or if the user doesn't want it like that, then it will be held personal. Any type of help will help. I am using C# WinForms on .NET 4.0.

Thanks guys!

推荐答案

我用的一个 TreeView 来表示代码段类别(根节点)和代码段(以及可能(稍后)的文件夹?)。然后创建一个类来表示你的片段(实际的片段字符串和其他元信息(如果你只处理真实片段,你甚至可以从片段中读取元信息(xml-parsing)。你可以为自己实现这个类,将它映射到数据库条目,或者你可以使用像LinqToSql或EntityFramework这样的OR-Mapper来生成类,如果你更喜欢模型或数据库第一种方法。这应该只是给你一些启示...
I'd use a TreeView to represent the snippet categories (root nodes) and the snippets (and maybe (later) folders?). Then create a class to represent you snippet (the actual snippet string and additional metainformation (if you deal only with "real" snippets you could even read the metainfo out of the snippets (xml-parsing). You can implement this class for yourself and "map" it to database entries, or you could use a OR-Mapper like LinqToSql or EntityFramework to generate the classes if you prefer model or database first approach. This should just give you some hints to start...


请参阅我最近的回答:如何在ListBox中删除此字符'_' [ ^ ]。



-SA
Please see my recent answer: How do I remove this character '_' in ListBox[^].

—SA


谢尔盖,



这似乎不是我的要求,我很抱歉sion!



johannesnestler,



你说要把它映射到数据库,有什么好文章吗?你建议吗?
Sergey,

That doesn't seem to be what I was asking, I am sorry for the confusion!

johannesnestler,

You say to map it to a database, is there any good articles you recommend for that?


这篇关于需要在文本框中制作listivew显示数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆