I added an imagelist to my listview, and it always add the first image in the list to the first column.
I can eliminate the image, but it always leave a space for the image before the text, changing my aligment from left to sort of right.
Is there a way to override this?
Dim item1 As New ListViewItem(sJC(idx).FINVNO.ToString)
item1.Checked = False
I used some code that extends the listview so you can add an icon or image to a subitem.
It adds the image, but I want to center the image in the column
So the code sends a message to the pump setting the cell.
I've done some c++ with listview, but I can't remember if I can send a message to the pump to center the image.
Public Sub AddIconToSubitem( _
ByVal row As Integer,
ByVal col As Integer,
ByVal icon_num As Integer)
Dim lvi As New ListViewWithIcons.LV_ITEM()
lvi.iItem = row ' Row.
lvi.iSubItem = col ' Column.
' Indicate what we're setting.
' lvi.mask = ListViewWithIcons.LVIF_IMAGE Or
lvi.mask = ListViewWithIcons.LVIF_IMAGE
' Image index in the ImageList.
lvi.iImage = icon_num
' Send the LVM_SETITEM message.
ListViewWithIcons.SendMessage(Me.Handle, ListViewWithIcons.LVM_SETITEM, 0, lvi)
I looked at the structure for LVITEM, and didn't see anything for alignment.
Public Structure LV_ITEM
Public mask As UInt32
Public iItem As Int32
Public iSubItem As Int32
Public state As UInt32
Public stateMask As UInt32
Public pszText As String
Public cchTextMax As Int32
Public iImage As Int32
Public lParam As IntPtr
Is it default behavior for the listiew to resize the image large, I made my image 16x16 but it always displays larger.
I looked at ownerdraw, was looking for a shortcut. Yeh right!
I finally figured out that you set the image size in image size.
The images are suppose to go in front of the text, this the view setting like files in a windows form.
I was able to center my image with a wider image, but then the first column shows the image.
So I guess for now, I'll just move the success column to the first position.
I am attempting to create a list of lists so I can return a specific list when I reference list(index), for example. I created a custom class and am using it as the list type.
A subroutine reads through a text file (csv) one line at a time. The value in the line indicates the "section number" to which the rest of the line belongs, and all other values on that line are used to set certain properties in my custom class. (Confusing?)
Basically it reads through the lines, and if the first number is the same as the first number in the previous line, it processes the line and adds it to a list. If the number is different, it adds the list to the main list, then clears the list, and adds the current line to the new list.
And repeat until the end of the file.
Here is the code:
Dim EvalTopics As new List(of List(of customClass))
Dim sr As StreamReader = New StreamReader(BLAHBLAHBLAH)
Dim OldSec As Integer = 0, NewSec As Integer = 0'Old and New Section Numbers
Dim seclist As New List(Of customClass) 'List to be added to EvalTopics
While Not sr.EndOfStream
Dim splits() As String = sr.Readline.Split(",")
NewSec = splits(0) 'Section # is first value
If OldSec <> NewSec Then
OldSec = NewSec
Dim es As customClass = New customClass
'assign the other values to various properties
EvalTopics.Add(seclist)'Add the last section
After populating the lists, if I call up EvalTopics(0), I get the same as EvalTopics(3). In fact, every list I call up is the same as the LAST LIST ADDED.
Can someone point me in the right direction? At first I thought I was using lists incorrectly, so I tried an array of lists, then a list of arrays. Nothing worked.
Example I made a solution program in vb.net called BookProgram then the compiler for debug is 32bit or x86 and for such coding I simultaneously made also on that solution x64 compiler debug (/assume they were on bin folder)
So is it possible to put a code that design to hide the form x86 program and show x64 form program vice versa without errors even though made in one solution program?
That concrete example is based on an uninstaller program because the anycpu is based on the current bit system and programs are likely missing vice versa to 86x compiler.
If the build target of the program was x86 (i.e. 32bit), the program will run in 32bit mode both on x68 and on x64 computers.
If the build target of the program was x64 (i.e. 64bit), the program will run in 64bit mode on x64 computers, but crash when you try to start it on x86 computers.
If the build target of the program was "Any CPU", the program will run in 32bit mode on x68 computers, and in 64bit mode on x64 computers.
Your code "isn't working" because you are saving the image to a file, you're not attempting to save it to a database.
Having said that, it is probably the better option - save the image to a specific folder then store the name of the file on your database
In addition to CHill60's comments, you are displaying a "image saved" message, without any checks to see that you have actually saved it. I see this more and more these days and find it quite worrying.
Saving images into an Access database can be a very bad idea, depending on the version you are using. Earlier versions stored images as uncompressed bitmaps, even if the original image was in a compressed format, such as jpeg
It's much better to store the image on disk, and store a pointer (path and filename) in the databse, and load the picture at runtime
I'm an optoholic - my glass is always half full of vodka.
I've been using batch scripts to help automate pre-loads (pre configurations) of client computers for software installations. We support multiple software packages, from multiple program vendors.
What happens now is that the batch script asks a series of questions to "build" subsequent scripts to help with the automation. It works, but it's old-fashioned and brute force. Unfortunately, my programming background is batch and dBase, so I'm a little out of my depth. I'm up for a project, and would love to learn to program using this task as my educational trip!
Here's What I would like to do:
Have a script / application which starts a "GUI" to collect data (the variables used to install the various applications) and document the installation. Once done, the script should be able to SAVE The data to a file (thinking XML) and then fire off chained installations and or allow the technican to pick and choose what they would like to do (say something breaks mid-way through the chain, re-start at that point).
Is this something I should do with VBScript or a VB Application?
Thanks in advance for any help you can give me,
I've looked at a few and feel that the scope of our varied projects kind of precludes using them.
For example: Need to install 3 packages with command-line swithches
Need to apply registry "tweaks" to some based on the data locations found at the client site (we do not control this variable)
Need to apply patches based on end-user preferences.
The flexibility of our current setup is that it allows us to create / re-create on the fly while onsite. We are only onsite for the installation and don't necessarily have return visits to the location.
Yes, I was aware of that Richard, my question was would it be better to start it out in VB, VBScript, or perhaps you had a different recommendation. I specifically didn't mention using other vendor products. This isn't a speed-dependent undertaking, it's more of a learning process with a pay-off in the end in terms of having something custom and flexible for our small, but highly custom fishbowl.
Ok, I see you edited the response, thanks for the point. I've got some basic apps written in VB, so I'll most likely continue on using that. Thanks for your help and advice.