|
Hi Simon,
sorry for the late response which was due to a short holiday of mine. Thanks for your hint which pushed me in the right direction: In the end, all I had to do was change "function" into "sub" in VB. It's finally solved now, and the line
items.WithProgressReporting(Sub(progress) worker.ReportProgress(progress)).ForEach(Sub(item) Thread.Sleep(10)) works, as well as Estys suggestion to factor out the subs. No "end" needed here.
Regards - Mick
|
|
|
|
|
Glad it helped
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Try changing this line:
items.WithProgressReporting(Function(progress)
worker.ReportProgress(progress)).ForEach(Function(item) Thread.Sleep(10))
To this:
items.WithProgressReporting(Function(progress) _
worker.ReportProgress(progress)).ToList.ForEach(Function(item) Thread.Sleep(10))
The .ForEach extension method doesn't work with IEnumerables and since that's what WithProgressReporting returns, the resultset must first be cast as a Generic List. Also, I don't know for sure, but it looks like the converter inserted an extra line break. That's why I added the underscore to the end of the first line.
modified 3-Jan-12 19:59pm.
|
|
|
|
|
Hi Member... ,
sorry for the late response which was due to a short holiday of mine. Thanks for your hint which unfortunately didn't work: In the end, all I had to do was change "function" into "sub" in VB. It's finally solved now, and the line
items.WithProgressReporting(Sub(progress) worker.ReportProgress(progress)).ForEach(Sub(item) Thread.Sleep(10)) works, as well as Estys suggestion to factor out the subs (no "end" or "ToList" constructions needed).
Regards - Mick
|
|
|
|
|
I always have trouble with anonymous delegates in VB so I factored them out :
Class Program
Shared worker As BackgroundWorker
Public Shared Sub Main()
worker = New BackgroundWorker()
worker.WorkerReportsProgress = True
AddHandler worker.DoWork, AddressOf DoWork
AddHandler worker.ProgressChanged, AddressOf ProgressChanged
worker.RunWorkerAsync()
Console.Read()
End Sub
Private Shared Sub DoWork(ByVal sender As Object, ByVal e As DoWorkEventArgs)
Dim items = Enumerable.Range(1, 1000)
items.WithProgressReporting(AddressOf ReportProgress).ForEach(AddressOf DoSleep)
End Sub
Private Shared Sub ReportProgress(ByVal progress As Integer)
worker.ReportProgress(progress)
End Sub
Private Shared Sub DoSleep(ByVal item As Integer)
Thread.Sleep(10)
End Sub
Private Shared Sub ProgressChanged(ByVal sender As Object, ByVal e As ProgressChangedEventArgs)
Console.SetCursorPosition(1, 0)
Console.Write(e.ProgressPercentage)
End Sub
End Class
Cheers
|
|
|
|
|
Hi Estys,
sorry for the late response which was due to a short holiday of mine. Thanks for your hint which, together with the other guys' ideas, pushed me in the right direction: In the end, all I had to do was change "function" into "sub" in VB. It's finally solved now, and the line
items.WithProgressReporting(Sub(progress) worker.ReportProgress(progress)).ForEach(Sub(item) Thread.Sleep(10)) works, as well as your suggestion to factor out the subs. Just to complete: In your snippet I had to change the definition of 'items' to:
Dim items As IEnumerable(Of Integer) = Enumerable.Range(1, 1000) in VB. But the most important thing: It works - and I hope I understand it a little better
Thanks again,
regards - Mick
|
|
|
|
|
Michael Schäuble wrote: I had to change the definition of 'items'
That's odd, with me it worked as I posted it.
I'm on .NET 3.5, VB Express 2008
Cheers
If you can read this, you don't have Papyrus installed
|
|
|
|
|
In VB, a function that returns void is a "Sub". This is true with lambda function as well. So your ForEach lambda should be
ForEach(Sub(item) Thread.Sleep(10))
|
|
|
|
|
Only true with 2010 though, as there is many time I would loved to of used it in my current project that is 3.5 framework
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Hi David,
sorry for the late response which was due to a short holiday of mine. Thanks for your hint which pushed me in the right direction: In the end, all I had to do was simply change "function" into "sub" in VB. It's finally solved now, and the line
items.WithProgressReporting(Sub(progress) worker.ReportProgress(progress)).ForEach(Sub(item) Thread.Sleep(10)) works, as well as Estys suggestion to factor out the subs (slightly changed).
Thanks again,
regards - Mick
|
|
|
|
|
i create purchase and sales tables forms also a create
Excise from how to add purchase from sales from
Excise
Description: Details about Excise
FieldName Datatype Constraints Description
Exciseid Numeric(4) PK Excise id number
Purchaseid Numeric(4) PK, FK ID of purchase
Salesid Numeric(4) PK, FK ID od sales
Excisecode Numeric(4) Enter the Excise code
ExciseDate Datetime Datetime of excise
ple rpy me.
|
|
|
|
|
Excise
Description: Details about Excise
FieldName Datatype Constraints Description
Exciseid Numeric(4) PK Excise id number
Purchaseid Numeric(4) PK, FK ID of purchase
Salesid Numeric(4) PK, FK ID od sales
Excisecode Numeric(4) Enter the Excise code
ExciseDate Datetime Datetime of excise
|
|
|
|
|
My application is in VB6 and environment is Window XP. We are using WebBrowser control to display data of Word doc files i.e. we are opening word files always inside the WebBrowser control and then modifying word file using macros.Our application send email to user with body as word files i.e we paste word file data into email body part.Our VB code is perfectly working with office 2003 and office 2010.We are doing following changes in window registry via VB6 code for temporary basis:
1)..HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Word.Document.8\
updating BrowserFlags value to H80000024
2)..HKEY_CLASSES_ROOT\Word.Document.8\
updating EditFlags value to 65536
3)..HKEY_CLASSES_ROOT\Word.Template.8\
updating EditFlags value to 65536
4)..HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Word.Document.12\
updating BrowserFlags value to H80000024
5)..HKEY_CLASSES_ROOT\Word.Document.12\
updating EditFlags value to 65536
6)..HKEY_CLASSES_ROOT\Word.Template.12\
updating EditFlags value to 65536
Now we are migrating environment from WinXP to Win7. I have following query for Win7 environment :
1) Will we able to do registry changes using VB6 code on the all same path as mentioned above ?
2)Will Word doc files always open inside webBrowser control ?
3)Do we require additional registry changes for BrowserFlags and EditFlags via VB6 code ?
4)Please suggest us what else we have to do for registry changes and to send email ?
I have one more query .If Win7 support team does not give us rights to change registry then without changing values of BrowserFlags and EditFlags , how word docs files will open inside webBrowser control of VB6 ?
|
|
|
|
|
Your uses will not be able to modify anything under LOCAL_MACHINE or CLASSES_ROOT, so your questions are irrelevant.
You don't need a webbrowser control to open/edit/print Word documents. I suggest you Google for "VB6 Office Interop".
|
|
|
|
|
Will I able to open & modify word doc using VB6 Office Interop ?
|
|
|
|
|
What did I tell you to do?? Google it and find out. You might want to try "VB6 eidt Word document".
|
|
|
|
|
Fortunately Google seems to know you're occasionally a tad dyslexic.
|
|
|
|
|
My fingers are dyslexic. My mind is so frustrated with their inability to type. So much so, it's thinking of outsourcing the typing.
|
|
|
|
|
we can edit word doc by VB6 Office Interop but I am not able to find control in VB6 to view and edit word doc except webBrowser control.Please help me to find solution.
|
|
|
|
|
That's because there is no control. You can show Word on your form. You just have to do a little research to find out how. I already told you what to Google for. You just have to read the results to find it.
|
|
|
|
|
Thanks for your reply.But in my case it is prerequisite to show word file in a control like webBrowser. we have maintenance project and currently using WebBrowser control in VB6 and it is working fine in WinXP environment.Our VB6 code is doing window registry changes for BrowserFlags & EditFlags.
But on win7, we have no rights to do registry changes.So I am looking for solution to open word file inside WebBrowser control of VB6.We are also editing word file via VB6 code.
|
|
|
|
|
Nitin Varshneya wrote: But in my case it is prerequisite to show word file in a control like webBrowser
That is not a requirement. That is a preference.
I spent about 5 minutes Googling for "show word in vb6" and found a small bunch of solutions to your problem, none of which use a webbrowser control. If you insist on using one, fine. Good luck finding a solution. If not, you know what to Google for. All you need to do is teach yourself something new.
|
|
|
|
|
How to use WebBrowser control in VB6 to open,edit,close,save and print an Office document on Win7 machine ?
I read that we needs to update BrowserFlags and EditFlags value of window registry via VB6 code to open word doc inside the webBrowser control but we do not have rights to edit window registry on win7 machine .
|
|
|
|
|
First, why are you still using VB6?? Do you know that there will be no VB6 runtime support in Windows 8?
Next, why are you using a web browser control? You just need to use Office Interop to do these things. No, I don't have any examples because VB6 has been dead for years and I haven't touched in since 2001.
|
|
|
|
|
we can edit word doc by VB6 Office Interop but I am not able to find control in VB6 to view and edit word doc except webBrowser control.Please help me to find solution.
|
|
|
|