|
Hello everyone
I want to open excel in vb.net for that i write code like.
Dim xl As Excel.Application
Dim xlWorkBook As Excel.Workbook
Dim xlWorkSheet As Excel.Worksheet
Dim misValue As Object = System.Reflection.Missing.Value
xl = New Microsoft.Office.Interop.Excel.ApplicationClass
xlWorkBook = xl.Workbooks.Add(misValue)
xlWorkBook = xl.Workbooks.Add(misValue)
xlWorkSheet = xlWorkBook.Sheets("sheet1")
but it show an error as
"Member not found. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))"
|
|
|
|
|
Which line? Have you added correct Excel reference?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Hello Experts,
I want to do datagridview columntype as checkbox by coding,only one columntype must be checkbox and rest of are textbox.
Please help
|
|
|
|
|
Just create an instance of DataGridViewCheckBoxColumn class and add it to Columns collection of your DataGridView .
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Thanx,I get little bit what you written
But Please can you give me code for same so i will get it clearly...
|
|
|
|
|
So you want him to snd the codz plz
Don't be pathetic, use Google[^], look for yourself.
|
|
|
|
|
C# code:
DataGridViewCheckBoxColumn oCol = new DataGridViewCheckBoxColumn();
DataGridView grd = new DataGridView();
grd.Columns.Add(oCol);
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Thank you for your help..I have another query if i checked 3 record from grid then this all record must be store in array so i can use that array for crystal report of these 3 userid.Any help!! or suggest me better way!!
|
|
|
|
|
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.
|
|
|
|