|
Hi,
I added 2 pictures
Picture 1 and Picture 2
Both are from different classes.
i want them to load into the same listview with the same subroutine(sub sFillListview(c as collection)) or something like that.
Prefereble with headers.
Like you can see picture 1 has only 2 columns but picture 2 has 23
thanks already for looking
Jan
|
|
|
|
|
If you want to do a kind of automation you need something what your different classes have in common.
You should provide much more details - perhaps there is a solution ...
|
|
|
|
|
Your classes have nothing in common, so your "single method to do it all" idea won't work. So, how is your "one method to rule them all" supposed to know how to handle each different class passed in the parameters?
Are you looking to take the data from these classes and format it somehow to be added to a ListView? If that's the case, you have to add something to these classes to give something in common. Create an Interface that both of these classes implements so each class can supply code to format itself to be used in a ListView:
Public Interface IListViewFormat
Function ListViewFormat() As String
End Interface
Now, each class has to implement the interface and supply the code for the ListViewFormat method.
Public Class Aansluiting Implements IListViewFormat
... properties code ...
Public Function ListViewFormat()
return String.Format("{0} - {1}", ID, aansluiting)
End Function
Then you can change your List to be a collection of IListViewFormat and pass that to your method that adds the items to a ListView.
Dim collection = New List(Of IListViewFormat)
... add your items to the List and pass it to the method
Public Sub AddToListView(ByVal collection As IList(Of IListViewFormat))
For Each item In collection
ListView1.Items.Add(item.ListViewFormat)
Next
End Sub
modified 18-Apr-17 19:28pm.
|
|
|
|
|
Seems that there is no direct solution. I have added another function that return a simple collection.
In item 1 I return fieldnames, fieldtypes and fieldsizes. The other items contains the real elements.
that way I have all I want.
Thanks for thinging with me.
Jan
|
|
|
|
|
The suggestion of Dave is the direct Solution ...
If your classes have nothing in common you have to create something. This could be an interface.
Now you are able (by reflection) to detect those classes which have this interface and put them (or a content from them) into a List.
|
|
|
|
|
Hi there,
I have a requirement where I need to design a code of an application for the Master Slave communication via serial ports.I got the idea how to send and read data via serial ports in VB
but i got stuck about how to code the logic so that Master will throw data packet over the channel
and it will be listening to all the slaves but data will be actually received by the particular slave which Slave ID is mentioned and ignored by the all other Slaves.
|
|
|
|
|
You don't get more answers if you ask your question as Discussion and also as Q&A ...
|
|
|
|
|
First, since this is new development work, ABANDON VB6 NOW. You have no real reason to use it. It's been obsolete for the last 16 years.
Visual Studio 2017 Community is FREE and you get a modern version of the language.
|
|
|
|
|
Any one can help me ? i'm stuck Please :'(
|
|
|
|
|
You stuck with what ?
I'm sorry but this is so vague that an answer is nearly impossible ...
|
|
|
|
|
what are scale mode , scale height , scale width in vb in picture box ...how to do in mfc.
how to do call 32 bit vb ocx in 64 bit environment
|
|
|
|
|
|
please I need help on how to create a 3d form and button in visual studio. am using VB 2013
|
|
|
|
|
Yeah, there's really no answer to this vague question because you haven't spelled out what you mean by "a 3D form and button".
|
|
|
|
|
Please fellower friends I need help on how to restrict a label as an output to take floating point values with 3 decimal places
|
|
|
|
|
Really? A label has no way of limiting what is put into its Text property. You have call ToString on the value you're displaying and provide the number format string to limit the result to 3 places while formatting everything to the left of the decimal to whatever specification you want.
See Standard Numeric Format Strings[^] for more.
|
|
|
|
|
As Dave allready has written ...
But there is another possibility :
You create your own (customized) AnalogueLabel which derives from Label and has a Property 'Value' which type is for example single (or double).
If a legal value is assigned to this Property you can assign it to the Text-Property with the rerquired formatting :
Public Class AnalogueLabel
Inherits Label
Property Value As Single
Get
Return my_Value
End Get
Set(value As Single)
my_Value = value
Me.Text = my_Value.ToString("F3")
End Set
End Property
Private my_Value As Single = 0.0
End Class
|
|
|
|
|
I have a string...
<pre><add name="ConDB" connectionString="‘Ú·ÐŽÇáäޯΟ£‘ ª~«q œª¤ªµºÒÖÛÂÞ™Ú·ÐÚãÙ¬°ŽÀÇÛÈÚ»¿â§ÖÓ¯ÇâѾ‰«¶žØëˆÉ¤âáëááЉ³ÃÝÂäí®ªu¢©ÁÛÝŒœØÑÞÅâÇÞ€¤©ÁÓ猜ØÑÞÅâÇÞ€¥ž¯"
providerName="System.Data.SqlClient" />
How to change connection string above into regular string...
|
|
|
|
|
You need to know both the encryption algorithm and the key.
Cheers,
Mick
------------------------------------------------
A programmer is a person who always checks both ways when crossing a one-way street.
|
|
|
|
|
im newbie programmer... im not understand...
please advise... 
|
|
|
|
|
The data is encrypted so if you do not know how it was encrypted there is nothing you can do.
|
|
|
|
|
Can i change the string with:
<add name="ConnDB" connectionString="Data Source=localhost; Initial Catalog=DB_WB; User Id=sa; Password=123456; Integrate Security=false"
providerName="System.Data.SqlClient" />
|
|
|
|
|
Try it and see what happens.
|
|
|
|
|
If you typed that into the code, sure, it might work, IF that connection string is appropriate for your database and database engine.
Also, if that is an appropriate connection string, using the SA account is a horrible idea and a huge security risk to your database and the database server, subjecting both to being destroyed. Google for "SQL Injection Attack" for more information on why that is.
|
|
|
|
|
good morning to all
any help me to do report card generation uing vb.net 
|
|
|
|