|
I actually have 2 questions
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
item1.SubItems.Add(sJC(idx).FCUSTNO)
item1.SubItems.Add(sJC(idx).FTRANSDATE)
item1.SubItems.Add(sJC(idx).FTRANSTIME)
item1.SubItems.Add(sJC(idx).FCOMPANY)
item1.SubItems.Add(sJC(idx).FCONTACT1)
item1.SubItems.Add(sJC(idx).FEMAIL1)
item1.SubItems.Add("")
item1.SubItems.Add("")
lv_journal_icons.Items.Add(item1)
Question 2:
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
' ListViewWithIcons.LVIF_TEXT
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)
End Sub
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
End Structure
Queston3:
Is it default behavior for the listiew to resize the image large, I made my image 16x16 but it always displays larger.
|
|
|
|
|
Sounds more like a candidate for owner-drawing
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Yeh
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.
|
|
|
|
|
jkirkerx wrote: I looked at ownerdraw, was looking for a shortcut. I've often used it as such
jkirkerx wrote: So I guess for now, I'll just move the success column to the first position. Nice how there's almost always a clean and easy solution.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
How to Add DatagridView in ByVal ComboBox
|
|
|
|
|
|
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
EvalTopics.Add(seclist)
seclist.Clear()
OldSec = NewSec
End If
Dim es As customClass = New customClass
With es
'assign the other values to various properties
End With
seclist.Add(es)
End While
EvalTopics.Add(seclist)'Add the last section
sr.Close()
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.
|
|
|
|
|
Instead of
seclist.Clear()
use
seclist = New List(Of customClass)
Adding seclist to Evaltopics adds a reference, not a copy.
So it's necessary to create a new List after adding.
Cheers
|
|
|
|
|
Dang it... I KNEW that, too! I guess it is time to start drinking coffee again.
Thanks to both of you!
|
|
|
|
|
You don't get copies of Lists, or any other reference type, without explicitly making the copies. It's never done implicitly.
|
|
|
|
|
My question has a scenario like this..
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.
|
|
|
|
|
I really hate to tell you this but I've read and re-read your post a dozen times and nothing in your post was understandable. I have no clue what you're doing nor what you're having a problem with.
|
|
|
|
|
You would need a third program that will launch either the 32 or 64-bit version as appropriate.
|
|
|
|
|
What type of program will be like to open either 32 bit and 64 bit?
|
|
|
|
|
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.
|
|
|
|
|
guys can someone help in this problem i have been trying to save image into access table but the code i using is not working. here is the code
Private Sub Loadpicture_Click()
Dialog1.ShowOpen
Img.Picture = LoadPicture(Dialog1.FileName)
Private Sub Save_Click()
SavePicture Img.Picture, App.Path & "\photos\" & txtfullname.Text & ".jpg"
MsgBox "image saved", vbInformation, "New Solutions"
Adodc1.Refresh
|
|
|
|
|
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.
=========================================================
|
|
|
|
|
Hi,
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,
Scott
|
|
|
|
|
There are various installer programs available that will do all the hard work, and Google will find them for you.
|
|
|
|
|
Richard,
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.
Thanks for your speedy response,
Scott
|
|
|
|
|
Well just about every other manufacturer finds that one or other of them works OK. If you feel that none of them meets your requirements then you have a long job ahead of you writing your own.
[edit]
I don't think this is a job for either VBScript or VBA, but for a proper programming language, like VB.NET or C#.
[/edit]
|
|
|
|
|
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.
-Scott
|
|
|
|
|
It may be worth looking into AutoIT[^].
I have not used it in anger, so to speak, but have heard it recommended on a few occasions and the scripting language does seem to have the features you are looking for.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|