|
Thanks Sir
It works Fine but i have generate a second question regarding same topic.
While i am using the Import data from Excel to List there are Excel Applications will be open.
So please describe me how to close it.
If you can think then I Can.
|
|
|
|
|
Assuming you've got something like this:
Dim objExcel As Excel.Application = Nothing
objExcel = New Excel.Application
Then something like this could do it:
If Not (objExcel Is Nothing) Then
objExcel.Quit()
objExcel = Nothing
End If
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
The only valid measurement of code quality: WTFs/minute.
|
|
|
|
|
Thanks Dear
Actually i was finding the close or exit method.
If you can think then I Can.
|
|
|
|
|
eg_Anubhava wrote: I am Providing Range From (A1:A100000) to (XFD1:XFD100000). But it takes a lot of time.
Seriously?? What user on this earth would want to look through a ListBox with BILLIONS of items in it?? Rethink what you're doing and how your user interface is going to work.
|
|
|
|
|
Can you imagine trying to find the specific item in the listbox?
</murder myself>
|
|
|
|
|
Why kill yourself when there's a perfectly incompetent "developer" to hunt down and torture instead?
|
|
|
|
|
I'm using vb.net 2008.
I bind a datasource to a datagrid with this code:
Public Sub dgContactpersonen_fill(ByVal ID As Int64) ' vullen dgContactpersonen
' vullen dsContactpersonen
dsContactpersonen = MoonData.MoonData.DataModule.GetRelatie_Contactpersonen(CInt(ID))
' definieren view
Dim dview As New DataView(dsContactpersonen.Tables("Relatie_Contactpersonen"))
' binding dgContacten met dsContacten
dgContactpersonen.RowTemplate.Height = 18
dgContactpersonen.DataSource = dview
When I add a new record using a different form i want the datagrid to be refreshed. I've tried these methods but they don't work
Method 1:
Call frmRelatiebeheer.UsrRelaties1.dgContactpersonen_fill(CInt(txtBedrijfId.Text))
frmRelatiebeheer.UsrRelaties1.dgContactpersonen.Refresh()
Method 2:
Dim bs As New BindingSource
dsContactPersonen = MoonData.MoonData.DataModule.GetRelatie_Contactpersonen(CInt(txtBedrijfId.Text))
bs.DataSource = dsContactPersonen
frmRelatiebeheer.UsrRelaties1.dgContactpersonen.DataSource = bs
bs.ResetBindings(False)
Any suggestions?
|
|
|
|
|
You could try to implement the INotifyPropertyChanged interface.
|
|
|
|
|
hi all!
I can't rid of Cell value error from datagridview.
dim mytext as string
mytext = datagridview(0,3).index.value
error occurs if cell value is null.
|
|
|
|
|
Hello,
You can use:
If not isnull(datagridview(0,3).index.value) then
mytext = datagridview(0,3).index.value
End if
|
|
|
|
|
Hi all,
I need to extract the first frame (or some frame) of a video file (wmv, avi) at a given physical location; and save it as a bitmap at some other location. It's such a tiny task.
I am willing to write my own C++ class or VB class which can do this.
(This is to be ultimately referenced in our vb 6.0 business logic layer.
I know, there is a Microsoft's Direct Show library in Windows System 32, and that I can use it. I used it and it worked on systems bases on WindowsXP or Winows Server 2003. It failed on Windows Server 2008 as Windows Server 2008 doesn't have qedit.dll. Copying qedit.dll from Windows XP and registering it didn't help either.)
Can some one guide where to start?
Thanks in advance,
Renuka Prasad.
|
|
|
|
|
|
|
I have searched everywhere and cannot find a definitive answer on this. I want to use a class to be created in a different thread to collect an image (or images) from the web. This is to run as part of a service. The thread is created thus:
Private Sub OnTimedEvent(ByVal source As Object, ByVal e As ElapsedEventArgs)
Dim cBR As New BackgroundRetrieveProcess(m_strURL, m_strImageName)
Dim t As System.Threading.Thread
t = New System.Threading.Thread(AddressOf cBR.GetImageFile)
t.Start()
End Sub
The outline of the class is thus:
Public Class BackgroundRetrieveProcess
Private m_strUrl As String = ""
Private m_strPlotName As String = ""
Public Sub New(ByVal URLAddress As String, ByVal PlotImageName As String)
m_strUrl = URLAddress
m_strPlotName = PlotImageName
End Sub
''' <summary>
''' This is the bit that does the retrieval of the image from the web
''' </summary>
''' <remarks></remarks>
Public Sub GetImageFile()
Try
'do the business here
Catch ex As Exception
'bog out here if there is a problem
End Try
End Sub
End Class
When the class has does the business how does it terminate? I have created a class, but there seems to be no way of destroying it when it has collected the image. Is it going to stay around in memory?
Obviously I don't want loads of these lying around in memory, but also I don't want to stop the main thread to wait for the class to finish (some of these can take a while to download). Basically each class needs to get the image and then cease existence. I can't find a way to end the class - but do I need to?
It is also possible that one may not have finished before the next one is started up (it is on a timer). Am I going to run into a problem here?
Thanks for any assistance.
|
|
|
|
|
Hi,
you shouldn't worry about having classes around; classes are just code (and some static data).
It is when you create one or more instances of a class, that objects get created; these may or may not hold lots of data, up to the point of being relevant. However, as soon as the last reference to such object has disappeared (when the object is no longer considered "alive"), the garbage collector can (and will) destroy it the next time the GC runs.
If you insist on worrying about it, you could:
- pass the parameters (URL and imageName) to the GetFile() method, so it does not need any class members; that allows you to make it static/shared, and hence you no longer need to instantiate that class;
- move the GetFile method to the BackgroundRetrieveProcess class; there is no real need to have it in a separate class!
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Thanks Luc
|
|
|
|
|
Hi everyone,
I've written a visual basic gui program (using visual studio 2008 (.net)) and simply placed a button on it which, when pressed, activates the print screen of the active window and it then opens powerpoint, adds a slide, and it's then suppose to paste the image. A new slide gets created each time the button is pressed, and the image is supposed to be pasted to the new slide.
The first iteration seems to work fine, but subsequent presses of the button yields the following error:
"System.Runtime.InteropServices.COMException (0x80048240): Shapes (unknown member) : Invalid request. Clipboard is empty or contains data which may not be pasted here. at Microsoft.Office.Interop.PowerPoint.Shapes.Paste()"
Other times the code goes an unlimited amount of button presses with no error, but when this occurs, the image is only updated every other button press. Any ideas?
Imports Microsoft.Office.Interop
Imports Microsoft.Office.Core
Imports System.Drawing.Imaging
Imports System.Runtime.InteropServices
Imports System.Diagnostics
Public Class Form1
' Start PowerPoint.
Public ppApp As PowerPoint.Application
' Start counting number of times the take image button has been pressed by the user.
Public num_times_pressed = 0
' Add a new presentation.
Public ppPres As PowerPoint.Presentation
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
num_times_pressed = num_times_pressed + 1
If num_times_pressed = 1 Then
ppApp = CreateObject("Powerpoint.Application")
' Make it visible.
ppApp.Visible = True
ppPres = ppApp.Presentations.Add(MsoTriState.msoTrue)
ppApp.WindowState = PowerPoint.PpWindowState.ppWindowMinimized
End If
' Add a new slide.
Dim ppSlide1 As PowerPoint.Slide
Dim SlideCount As Long
SlideCount = ppPres.Slides.Count
ppSlide1 = ppPres.Slides.Add(SlideCount + 1, Microsoft.Office.Interop.PowerPoint.PpSlideLayout.ppLayoutBlank)
Me.Hide()
SendKeys.SendWait("%{Prtsc}")
ppSlide1.Select()
ppSlide1.Shapes.Paste()
Me.Show()
End Sub
End Class
Thanks!
|
|
|
|
|
If the error says Clipboard is empty, then most likely SendKeys.SendWait("%{Prtsc}") does not always correctly do what is supposed to.
After the SendKeys bit, you could try checking the contents of the clip board first (My.Computer.Clipboard ), to see if the print screen was actually performed, and there is a picture to be pasted. If there isn't you just perform the SendKeys again, until the clipboard contains a picture.
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hi John,
Thanks for replying. The image is there because I can go to paint and paste it.
|
|
|
|
|
Hi, dear all,
I am using VB6. I am running a program created years ago. when I open a form, I got the following error:
Line 75: Property OleObjectBlob in dirDDBox could not be set.
Line 75: Cannot load control dirDDBox; license not found.
Line 83: Property OleObjectBlob in dirListBox could not be set.
Line 83: Cannot load control dirListBox; license not found.
Are dirDDBox and dirListBox shipped with VB6? or belong some other control that need register?
After I run VB6Cli.exe utility, still got the same error.
Can anybody help me. Thanks a lot.
|
|
|
|
|
Are those the names of the variables for instances of those controls? They don't look like the standard controls that ship with VB6. Neither expose a OleObjectBlob property.
|
|
|
|
|
Dave,
I look at the codes again, they should be variables, but I cannot make sure what are the control type of them since I cannot open the form, whenever I open the form, I got the error message.
What should I do in this case?
Thanks!
|
|
|
|
|
Open the file for the form in Notepad. It's just a text file.
|
|
|
|
|
Dave,
Thanks.
the dirDDBox variable is with PTxSCP.PTxShCombo type, and dirListBox is with PTxSCP.PTxShList.
The PTxSCP is third party contril from Plasmatech Software.
I register PTxSCP.ocx, but when I compile the program I got error, Permission denied.
Do you have any idea about this control?
|
|
|
|
|
Never heard of it.
You can reregister the control all you want. What's missing is some license data from the registry that gives you a design-time license so you can create your own apps with it in Visual Studio. I'd dig up the old installers if you can. Otherwise, it's going to be a trip to the vendor to get the fix.
|
|
|
|