|
Use the CellContentClick event of the gridview.
KIDYA wrote: suggest me better way!!
You never told if you have tried anything.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Here is code that should create a header with a checkbox in it. I want this checkbox to select or unselct all checkboxes in the grid depending on if its checked or not. Right now, nothing happens when you click this check box. any suggestions?
Dim column As New DataGridViewCheckBoxColumn()
With column
.HeaderText = "Select"
.Name = "NSelect"
.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells
.FlatStyle = FlatStyle.Standard
.CellTemplate = New DataGridViewCheckBoxCell()
.CellTemplate.Style.BackColor = Color.Beige
End With
DgvUserlist.Columns.Insert(0, column)
|
|
|
|
|
I don't seem to understand you.
KIDYA wrote: that should create a header with a checkbox
No. It will create a column with checkboxes in it.
KIDYA wrote: I want this checkbox
Which one?
Do you need a "Select All" checkbox or a checkbox column or both?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
I created column as checkbox but when i click on it nothing gonna happen like check or uncheck it seems to be read only
|
|
|
|
|
Hi all.
I'm searching files whose code is written in form1 and displaying these files in the listview of form2.
This code is written in form2 :
Private Sub BGWorker_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BGWorker.DoWork
For Each file As String In My.Computer.FileSystem.GetFiles(drive.Name, FileIO.SearchOption.SearchAllSubDirectories) 'drive.name is a directory
'Check for cancelation of Background worker.
If BGWorker.CancellationPending Then
e.Cancel = True
Exit Sub
End If
Dim extn As String = IO.Path.GetExtension(file)
Try
if extn.toUpper=".GPS" then
Me.RefreshList(file, FileType)
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
Next
End If
Next
End Sub
Delegate Sub UpdateList(ByVal [FileName] As String, ByVal [FileType] As String)
Private Sub RefreshList(ByVal [FileName] As String, ByVal [FileType] As String)
If frmMain.Listview1.InvokeRequired Then
Dim d As New UpdateList(AddressOf RefreshList)
frmMain.Listview1.Invoke(d, New Object() {[FileName], [FileType]})
Else
frmMain.Listview1.Items.Add([FileName].subitems.add([ThreatType])
End If
End Sub
In RefreshList module, I used frmmain instead of Me because I want to display searched files on the listview of frmmain but this code is not working.
Suggest me what should I do.
Thanks.
Gagan
|
|
|
|
|
Where does frmMain come from ? Why not use a delegate ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
frmmain is the main form of program.
where should I use a delegate?
|
|
|
|
|
does frmmain magically refer to the main form in VB.NET ? If not, it's a variable. What's the code that sets it's value ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
See....frmMain is the main form and appears when program starts.
Now when user search a file, form2 appears and actual code is written in form2 for searching files. But after searching files from form2 I want to display result on the listview of frmMain.
|
|
|
|
|
But this code is inside form2. frmMain is a variable inside form2. So, how is that variable's value set ? Where is it defined ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
frmMain is not a variable. It is main form.
|
|
|
|
|
So the listview is a shared variable ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Yes. Listview is a shared control drawn on frmMain.
|
|
|
|
|
Wow - that's a bit of VB nastiness I didn't know about. So, what happens if you have more than one instance of the frmMain class ?
Anyhow, VB sucks. You want to create a delegate so you can call it in your second form, and it calls a method in the first form, passing through the data.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
There is only a single instance of frmMain class.
Yes I want to use a delegate to show searched files on the listview of frmMain.
|
|
|
|
|
Gagan.20 wrote: There is only a single instance of frmMain class.
Yes, but I just did a test and found that while in C#, I'd tell anyone who made their form controls static that that is a TERRIBLE design, it seems in VB it does that for you. And, given that VB is doing it, what happens if I have more than one instance of a form ? It's insane. VB sucks.
OK, well, have you read up on delegates ? I'll be honest, I know a delegate is what you need, and I'd expect any basic tutorial on delegates in VB to give you the code you need, but I use C# ( did you notice I hate VB ? ) and so I can't tell you off hand what the syntax is.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hello to All,
My Print is of 9000 Pages so i want to view its Print Preview. But at the time of previewing its shows only first 1000 Pages.
So Please how to view All Pages Preview.
Thanks
If you can think then I Can.
|
|
|
|
|
Is someone seriously going to read through 9000 pages of a print preview ? Either this is a limitation of the control, OR it's a problem with your code.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
thank u sir
If you can think then I Can.
|
|
|
|
|
I think you may be the only person I've ever heard of that wants to preview 9,000 pages.
Seriously, I don't see why it would be a limitation in the control, but, it's entirely possible. Other than that, without any kind of error message or how you're handling printing, noone can tell you anything useful.
|
|
|
|
|
Maybe its a better idea to produce one big pdf file (or a lot of smaller ones ...)
|
|
|
|
|
a visual program that run an aplication and when application exit then vb program gives a message and it exits too
any help here ????????
|
|
|
|
|
master2323 wrote: any help here ????????
Lots, but you need to give a better explanation of what is not working, what messages you are seeing etc.
|
|
|
|
|
i can run mspaint using a a vb program ..but i wanna display a message to the vb program when i exit the mspaint
|
|
|
|
|
Ah. you can get a handle to the program in question when you call Process.Start and you can make your program wait until the other program finishes, or you can check it to see if it's still running.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|