Is it possible to have a combobox with LineShape lines in them instead of text?
if so how do i achive this?
Its for a drawing application im trying to make which alows the user to select difrent line types
(I'm using VB.Net)
You will have to inherit from ComboBox and create your own class. Set DrawMode = DrawMode.OwnerDrawFixed and handle OnDrawItem. There are many examples on how to do this. You can use this as start MSDN or Placing Images and Strings with a C# Combobox (in C# but you can easy convert this code to VB.NET)
Related
I googled a lot but I had absolutely no luck finding anything about my problem.
I would like to create ListBox - just like the one anyone can create using UserForms. The problem is that I do not want to draw it but write it with a code. I know how to add values to ListBox etc. The only thing I am missing is how to create it programatically.
I found this: Creating form programmatically in the module using vba but this code didn't work for me. It stops at declaring Forms.
The idea behind this ListBox is to create a ListBox to choose from sheets in a workbook to later do some stuff.
Me.Controls.Add ("Forms.Listbox.1")
allows you to add a control at runtime only using an event procedure.
I need to create combobox containing items with checkbox. This is winform VB.NET application.
I found some options but, those are in c# and also, in separate library.
I need some simple way like some single class which allow me to create item with checkbox and iterate checked items.
can any one suggest me way ?
Thank You
I want to add this feature within my program in were I select a subject from a combobx, and based of the selection I would like to display a block of text maybe from a txt file or an access database file and display the contents in a another textbox on the form that would allow the user to edit the info.
Im writing this in VB, and I was able to make a combo box and list the different subjects, I just need to be lead in the right direction as to where to start.
I haven't added any code simply because all I have is the basic combobox with the different selections. Any help would be greatly appreciated.
You really need to be clear on the source of the text for the textbox and how you're going to access it. One option is to use a custom class that holds the subject and the description. If you override the ToString method to display the subject, you simply set a List(Of CustomClass) as the datasource for the ComboBox and the SelectedItem cast as the CustomClass will hold the description that you can display in the textbox.
I'm a rookie at VBA(Excel) but I know some OOP stuff from java. What I want to do is extend the class MSForms.TextBox to add my own constructors and properties. I've tried using the implements keyword but my class won't compile. It would also be helpful to add these fields into some kind of container variable since they're arranged in a 9x9 pattern. Here's what I want my custom textbox to do. (It's for a game)
I need to be initiate it and place it on the form and put initial text into the box based on what is passed to the constructor. I also would like to have it check the values at runtime with an event to make sure they comply with the game rules. If it does not comply I would like to change the background color to red.
I'm able to do all of this when I just make a bunch of form controls the old fashioned way and use a sub controlled by a button to check the text box values.
Any help on extending classes would be much appreciated.
Thanks
I don't think you can do that in VBA. I would keep two arrays, one array of TextBox and one array of a new class representing your extended properties. Then you keep them in sync. e.g. Textbox #71 and extended properties #71.
You can look at the following link for making and working with control arrays.
http://www.siddharthrout.com/index.php/2018/01/15/vba-control-arrays/
I'm working on a VB project and I need some help with ListBox.
I need to create a ListBox which is populated by some data from a database. An alternative is of course DataGridView, but that's not what I want. I want to style my ListBox to output several strings from my database:
A title header
An icon
And some other sub-headings
This picture kind of demonstrates how I want it to look:
I have looked a bit into WPF, but I'm not sure how it's used with VB. This is a project for a VB-class I'm taking, so it's kind of mandatory that it is VB.