|
Hi,
I am new to vb.net and to this forum. Can anyone let me know how i can hide a listview column?
I am using the standard listview control available in the windows forms. I have set the view of the listview as Details. I need to hide the first column and for that i set the width property of the first column to zero. This makes the list view column invisible during the runtime. However if i place my cursor on the listview header and drag the same, the first column appears.
Is there anyway to hide the firstlistview column?
Thanks in Advance
Subha
Subha Narayanan
|
|
|
|
|
Hello,
There is no other way to do it. You implemented is right thing. I just have a additional to tell you.
Assign ColumnResize value to none means one can not resize the column. Then while filling data in ListView calculate the length of the record which you are filling currently. Then assign the record lenght value to the column width. By doing this, you will able to see full length data in your ListView without facing problem.
Example for consideration:
Dim iLenght as Integer ' Lenght of the record
Dim iPrevMaxLength as Integer ' Length of previous record
iLength = 0
iPrevMaxLength = 0
While(rs.EOF != NULL)
'Todo part
.....
.....
.....
.....
iLength = len(rs.CurrentRecord)
if iLength > iPrevLength then
ListView.Column(index).width = iLength
iPrevMaxLength = iLength
end if
' Todo part
.....
.....
.....
.....
Wend
Let me know if this works or not.
Regards,
Vilas Shewale
|
|
|
|
|
Retana Padilla has wrote a fine tool.
But...
(Excuse me, but my Englisch is not so good...)
I 'll try to use this code...
And make it better and better...
So I have set the EvMeasureItem.ItemHeight = 20
That is just enough to sign a rectangle round a icon (16*16) of 2 pixels width...
For instance I want tot use it in the header...
Then it goes wrong...
The second item in the header comes over the first item...
When I go over the first Item with the cursor
than you can't see the Icon in the second item in the header...
I think that the code have problems with:
The sub MeasureItems...
I don't understand very good how it's works.
Especially...
EvMeasureItem.ItemWidth = CInt(EvMeasureItem.Graphics.MeasureString (GetRealText(Mi), m_Font, 10000, sf).Width) + 10
(I have make it like this...
EvMeasureItem.ItemWidth = CInt(EvMeasureItem.Graphics.MeasureString (GetRealText(Mi), m_Font, 10000, sf).Width) + 30
It is better but not good enough...
And...
Also with the function GetRealText...
Can it be that sometimes the code don't got the real length in pixels?...
Another question is...
Is it also possible to manipulate the Item -----------------
I hope that someone can help me ...
Vriendelijke groeten
Gilbert
|
|
|
|
|
HI,
I've a collection which contains a couple of object I've created.
Is there a simple method to sort this collection or should I code a standard sort algorithm ?
|
|
|
|
|
if the Collection you are using is the one priovided by the .Net Framework(i.e. arrays, Arraylist etc.) you can just use:
Collection.Sort
But if the collection you are using is inherited, then you'll have to do the coding yourself.
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
I'm using standard collection object
but the sort method doesn't exist on collection object.
|
|
|
|
|
Hi,
I use for sort in a datatable Year and Week as Primary Key.
All is working fine.
Now I need to get the thuesday of the Year / Week date.
I was looking for a formula but I failed.
Can anyone help me resolving this silly problem ???!?!?
Thanx
Sybux
|
|
|
|
|
Hello,
Could you explain your problem in brief? like what exactly you want by providing us an example.
Regards,
Vilas Shewale
|
|
|
|
|
I know a year and a week
For example 2003 week 13
And I want to get the full date of the thuseday of this week.
So in my exemple, the function should return 04/27/2003
|
|
|
|
|
I have created a database query spreadsheet that pulls Customer ID's and corresponding Job ID's. There are a lot of calculations in this. I am using it as a reference for a separate Time Entry spreadsheet. If I use the Time Entry spreadsheet, I need to have the reference open. That might be too much for the user. I have 3 questions.
1. Is there a way to write a script that will open the reference and keep it invisible?
2. Should I just copy the cells from the reference into the timesheet and hide the tabs?
3. Will the CPU Usage be saved by choosing eother or will it stay the same?
My Brain hurts.
Thanks,
Nicole Sohenick
|
|
|
|
|
How can I extract a content from the OLE object as Text in C#? I have create in VB6:
...
OLE1.object.saveas "c:\tryFile.rtf"
...
and after that I started the Automation like
Set wordAutomation = CreateObject("Word.Application")
With wordAutomation
.Visible = False
.Application.Documents.Open ("c:\tryFile.rtf")
.Application.ActiveDocument.Select
.Application.ActiveDocument.content.Copy 'now is in Clipboard as Text
End With
...
How can I transform and implement this Code in C#?
Best regards
|
|
|
|
|
Hi,
I try to use ListsubItem object but i always this following error message:
Compilation error
method or data member not found
Can anybody help me please
thanks in advance
Cheickna
This is my code
Dim si As ListSubItem
Dim li As ListItem
Dim i, J As Integer
For i = 1 To 20
Set li = ListView1.ListItems.Add(Text:="Item " & i)
For J = 1 To 4
Set si = li.ListSubItems.Add(Text:="Subitem " & J)
si.ForeColor = vbRed
Next J
Next i
|
|
|
|
|
Don't use the add method. Try this:
Dim si As ListSubItem
Dim li As ListItem
Dim i, J As Integer
For i = 1 To 20
Set li = ListView1.ListItems.Add(Text:="Item " & i)
For J = 1 To 4
Set si = li.ListSubItems(J).Text = "Subitem " & J
si.ForeColor = vbRed
Next J
Next i
|
|
|
|
|
Is there some code or component to burn a CD programatically?
I have some data and have to save a CD from my system? Is there a way for doing this?
Thanks,
Mariano
Paranoico? yo???
|
|
|
|
|
If you have Nero 5.5 you could download their free sdk .
http://www.ahead.de/en/content/c1002825712128.html#c1002825712128[^]
I didn't used ... yet ...
Cheers,Joao Vaz
And if your dream is to care for your family, to put food on the table, to provide them with an education and a good home, then maybe suffering through an endless, pointless, boring job will seem to have purpose. And you will realize how even a rock can change the world, simply by remaining obstinately stationary.-Shog9
Remember just because a good thing comes to an end, doesn't mean that the next one can't be better.-Chris Meech
|
|
|
|
|
Hi!
I have a program that only runs the way I want it to from cmd line. Such as:
> myprogram "c:\mydirectory\file.dll"
Now, I want to automate running this program against a lot of dll's so the argument in the cmd line is bound to change. And the other thing is, I need to parse the output of the program dumped to standard out. So essentially, what would be great is if i can call something like:
> myprogram "c:\mydirectory\file.dll" > output.txt
I have the following code so far
---------------------------------------------------
Dim p As New Process()
Dim p_info As New ProcessStartInfo()
p_info = p_info.RedirectStandardOutput = False
p_info.UseShellExecute = True
p_info.FileName = "myprogram.exe"
p_info.Arguments = "c:\mydirectory\file.dll"
p.Start(p_info)
---------------------------------------------------
I tried setting UseShellExecute to false and for some reason, myprogram doesn't launch properly.
I can't have UseShellExecute and RedirectStandardOutput both true. So how do I accomplish getting this standard out?
Thanks for the help!
|
|
|
|
|
never mind
i found how it works
http://www.devx.com/dotnet/Article/7914/0/page/5
|
|
|
|
|
Hi,
I'm having a little problem sorting a 2 dimensional array, and I was wondering if someone could help. I want to sort the information in my array in decending numerical order. An example of my information is as follows: -
[50] [Bananas]
[10] [Lemons]
[30] [Oranges]
[100] [Apples]
I'd like it to sort the information from highest to lowest.
I'm using VB6, is this possible? Any help would be much appreciated.
Cheers
Ben
|
|
|
|
|
I'm afraid that there's no quick to way to do this, you'd have to do some coding. The best way, of course, if to implement a bubble sort through the first dimension, and change the second dimension accordingly
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
I always sort arrays using For loops. It might be a little slow for large arrays, but it always works for me:
Dim myNewArray() As String, q As Integer, r As Integer, s As Integer, t As Integer
ReDim myNewArray(UBound(myOldArray, 0), UBound(myOldArray, 1))
r = 9999999 'Just a big number (bigger than the biggest number in your array)
s = 0
For q = 0 To UBound(myOldArray, 0)
If myOldArray(q, 0) <= r Then
For t = 0 To UBound(myOldArray, 1)
myNewArray(s, t) = myOldArray(q, t)
Next
s = s + 1
r = myOldArray(q, 0)
End If
Next
I haven't tested this code, since I don't have VB6 installed at the place I currently am, but it should work. Just replace myOldArray by your array. You could even put this in a function, returning a String() .
"Make peace, not war"
|
|
|
|
|
I've a problem when using a command control in a form who is linked to a code that opens a executable program (Windows Media Player) and a Mp3's file. The Mp3's file is located in a folder that has spaces on it. The problem is the file doesn't open and the WMPlayer sends a message (file extension not recognized).
I know that the problem is in the spaces in the folder. Tanks a lot.
Here is the code:
Private Sub cmdPlay_Click()
On Error GoTo Err_cmdPlay_Click
Dim stAppName As String
Dim PlayFullName As String
PlayFullName = "G:\MP3\045- Mp3\test.mp3"
stAppName = "D:\Program Files\Windows Media Player\wmplayer.exe " & PlayFullName
Call Shell(stAppName, vbMinimizedFocus)
Exit_cmdPlay_Click:
Exit Sub
Err_cmdPlay_Click:
MsgBox Err.Description
Resume Exit_cmdPlay_Click
End Sub
|
|
|
|
|
The problem is the spaces, your right. But solution is also pretty easy. The problem comes because the spaces are seen as command-line argument seperators. This is the command-line your sending to Shell:
D:\...\wmplayer.exe g:\mp3\045- mp3\test.mp3
Your actually telling wmplayer that there are 2 command-line parameters:
'g:\mp3\045-' and 'mp3\test.mp3'
The solution is to put quotes around both parts of the command-line:
PlayFullName = chr$(34) & "G:\MP3\045- Mp3\test.mp3" & chr$(34)
stAppName = chr$(34) & "D:\Program Files\Windows Media Player\wmplayer.exe" & chr$(34) & " " & PlayFullName
Now your sending the command-line as:
"D:\...\wmplayer.exe" "G:\mp3\045- mp3\test.mp3"
The quotes will prevent the spaces from becoming argument seperators.
RageInTheMachine9532
|
|
|
|
|
I am chaning default printer using WshNetwork. In my project there is a printer pool and machine is Win2k. My code works fine on my machine(XP). But when i try to change the printer on Win2K it doesn't work, if one of the printer is turned off on the printer pool.
Here is the code:
Dim WshNetwork = CreateObject("WScript.Network")
WshNetwork.SetDefaultPrinter(cbobwprinter.Text)
MsgBox("Success")
Catch ex As Exception
MsgBox(ex.ToString)
MsgBox("Can't set the default printer!", MsgBoxStyle.Critical)
Any idea why it won't work in Win2K! .Net framework is installed on Win2K box. Thanks
Zulfikar Ali
|
|
|
|
|
Hello coders,
You know in VB6 there were some apis like
CreateREctRgn
CreateEllipticRgn
...
Is there any equivalent in VB.NET of one of those?
How do I use them?
Thank you
Have a nice day
Best Regards
Emre YAZICI
|
|
|
|
|
The following code can be used to change the shape of a control. It may give you some ideas about how to use regions:
Dim intDiameter As Integer = 200
Me.Height = intDiameter
Me.Width = intDiameter
Dim p As New Drawing2D.GraphicsPath()
p.AddEllipse(0, 0, intDiameter, intDiameter)
Me.Region = New Region(p)
Hope it helps
Regards
Wayne Phipps
|
|
|
|