|
Thank you, Ian, for your constructive support. It works fine now !
Somehow I had assumed that "dlg" would be the sender, so I was sure to have passed sender as well as the EventArgs.
Regards
Michael
|
|
|
|
|
Hi Michael,
Control.Invoke takes TWO parameters: a delegate and a parameters array.
(when no delegate parameters are required, there is a single-parameter overload too).
Examples are plenty, see here[^] for instance.
BTW: you really should find that in no time by looking at the documentation[^].
PS: and you'll have the opportunity to use curly brackets in VB!
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Thank you, Luc, for your answer. It's working fine now after inserting the form ('Me') as the sender !
My error was to assume that the delegate itself would function as sender i.e. the first parameter. This error occurred despite looking at samples and the documentation.
Regards
Michael
|
|
|
|
|
i am in need of ID3 decision tree code in vb.net or java for my project.
send me the link to sdeepan_cse@yahoo.com
|
|
|
|
|
Write it yourself. Noone here is just going to hand over their hard work so you get an easy pass at your own job. If you want examples, what's so hard about typing "ID3 decision tree VB.NET" into Google?
|
|
|
|
|
i already tried google search for ID3 decision tree source code in vb.net.
but i did not get any link which require for me.
|
|
|
|
|
Well, it looks like the only source code [^]you're going to get is in C#. You'll have to convert whatever code you find to VB.NET. Again, noone is just going to hand over their work to you.
|
|
|
|
|
Now you have published your email address I bet you get lots of 'code'.
You are on the wrong site, try rentacoder.com and pay for it - or admit you will fail your course/shouldn't have taken the job (delete as appropriate)
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Hello,
Wow, it's been 1 week, yes 1 week before i request any help about this nightmare.
It's seems almost impossible to have a simple VB code for what i want.
My goal :
- Query 30 printers with SNMP so i can retrieve their Page Counter.
I made a batch for that with the util "snmpget". So simple, but i would like to perform it all in Excel so it would be better to transfer it in VB.
I tried so many things, third party DLL, API, Winsock, WMI, SNMP... Some codes works but not everything, others simply don't, well...
I would like to work with this bunch of code :
strTargetSnmpDevice = "192.168.1.20"
Set objWmiLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWmiServices = objWmiLocator.ConnectServer("", "root\snmp\localhost")
Set objWmiNamedValueSet = CreateObject("WbemScripting.SWbemNamedValueSet")
objWmiNamedValueSet.Add "AgentAddress", strTargetSnmpDevice
objWmiNamedValueSet.Add "AgentReadCommunityName", "public"
Set colIfTable = objWmiServices.InstancesOf("SNMP_RFC1213_MIB_ifTable", , _
objWmiNamedValueSet)
For Each objInterface In colIfTable
WScript.Echo "ifIndex [Key]: " & objInterface.ifIndex & vbCrLf & _
" ifAdminStatus: " & objInterface.ifAdminStatus & vbCrLf & _
" ifDescr: " & objInterface.ifDescr & vbCrLf & _
" ifInDiscards: " & objInterface.ifInDiscards & vbCrLf & _
" ifInErrors: " & objInterface.ifInErrors & vbCrLf & _
" ifInNUcastPkts: " & objInterface.ifInNUcastPkts & vbCrLf & _
" ifInOctets: " & objInterface.ifInOctets & vbCrLf & _
" ifInUcastPkts: " & objInterface.ifInUcastPkts & vbCrLf & _
" ifInUnknownProtos: " & objInterface.ifInUnknownProtos & vbCrLf & _
" ifLastChange: " & objInterface.ifLastChange & vbCrLf & _
" ifMtu: " & objInterface.ifMtu & vbCrLf & _
" ifOperStatus: " & objInterface.ifOperStatus & vbCrLf & _
" ifOutDiscards: " & objInterface.ifOutDiscards & vbCrLf & _
" ifOutErrors: " & objInterface.ifOutErrors & vbCrLf & _
" ifOutNUcastPkts: " & objInterface.ifOutNUcastPkts & vbCrLf & _
" ifOutOctets: " & objInterface.ifOutOctets & vbCrLf & _
" ifOutQLen: " & objInterface.ifOutQLen & vbCrLf & _
" ifOutUcastPkts: " & objInterface.ifOutUcastPkts & vbCrLf & _
" ifPhysAddress: " & objInterface.ifPhysAddress & vbCrLf & _
" ifSpecific: " & objInterface.ifSpecific & vbCrLf & _
" ifSpeed: " & objInterface.ifSpeed & vbCrLf & _
" ifType: " & objInterface.ifType & vbCrLf
Next
I have 1 question :
- Set colIfTable = objWmiServices.InstancesOf("SNMP_RFC1213_MIB_ifTable", , _
objWmiNamedValueSet)
This line is driving me crazy. I understand it retrieves all IP configuration.
Straight from the RFC 1759 or the Printer-mib, i want to have THIS oid ! (1.3.6.1.2.1.43.10.2.1.4).
I checked, it's in the "prtMarkerEntry" class.
But how the hell i can specify it ?
Whenever i put Set colIfTable = objWmiServices.InstancesOf("SNMP_RFC1759_MIB_prtmarkerentry", , _
objWmiNamedValueSet)
i have then an error on the "FOR LOOP". ColIfTable is empty. How all this work ?
I read so many things, i'm lost. Do i need to insert any MIB into the WMI repositery ? The famous mof files and all that ?
Thanks in advance everybody.
|
|
|
|
|
From my very limited research on the topic (good luck finding a "simple" example for this!), it would appear that you're missing the MIB data that describes to the SNMP Provider how to translate between SNMP data and WMI objects.
This would be done using an SNMP information module file and running it through the SMI2SMIR compiler. You would either need to find an SNMP module file for the SNMP output of the printer in question, or write one yourself. Or, better still, if the manufacturer of the printer supplies a MIB file for it, you'd need to import that MIB into the SMIR (SNMP Module Information Repository) by running smi2smir /a <MIB file> .
|
|
|
|
|
Hello all,
I have a DOS based program I use to collect sales data from cash registers. I need to close this DOS window in a VBscript I would like to write.
When manually closing out of the window, the program that is open wants the user to type 'y' to quit the program before it will allow the DOS window to close.
Can someone give me some code to
1) Invoke the close method on the DOS window
2) Send the 'y' key to the DOS window?
This is operating on Win95.
|
|
|
|
|
If you use the WScript.Shell's Exec method[^] to launch your DOS app, you get an object back that lets you get at the StanardIn and StandardOut streams, giving you the ability to send keyboard input to the DOS app.
|
|
|
|
|
Thanks Dave!
That works perfectly...
However the app in question (command line) starts when windows starts. No big deal there, I could make a script to start the prog instead of calling the prog .exe
I actually would like to close the command line program via a scheduler at a certain time of day. So the potential issue here is, if I use the script to start the program, it will be running and running for 23+ hours before it sends the command to quit.
Ideally I would like to come up with a way to run a script from the scheduler that would close the command line window, then send the 'y' key to respond to the program.
Any ideas?
|
|
|
|
|
Can't be done from VBScript. After the DOS window is created, VBScript has no way of getting at the Standard I/O streams. You'd have to write a custom component, exposed through COM, in C++, C#, or VB.NET, to do what you want.
|
|
|
|
|
This might be over complicated but ...
What if you create a "watchdog" program that launches the child DOS window. Then the watchdog would be able to close the child window. You could even build into the watchdog the logic to automatically close the child at a predetermined time.
Otherwise, is it possible to re-write it as a VB.net console application ? You would have alot more control over the application.
|
|
|
|
|
I am getting an error: Before I show the error I will explain a sec.
32-bit OS works fine
64-bit OS Error.
The error is specifically on the form that has the Crystal reports module on it.
Crystal Reports Runtime library is installed.
Any suggestions on the Error? I have been searching the net without success.
System.InvalidOperationException: An error occurred creating the form. See Exception.InnerException for details. The error is: Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)) ---> System.Runtime.InteropServices.COMException (0x80040154): Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
at System.Windows.Forms.AxHost.CreateWithoutLicense(Guid clsid)
at System.Windows.Forms.AxHost.CreateWithLicense(String license, Guid clsid)
at System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)
at System.Windows.Forms.AxHost.CreateInstance()
at System.Windows.Forms.AxHost.GetOcxCreate()
at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
at System.Windows.Forms.AxHost.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.AxHost.EndInit()
at BondingBroker.frmViewWIPAnalysis.InitializeComponent()
--- End of inner exception stack trace ---
at BondingBroker.My.MyProject.MyForms.Create__Instance__[T](T Instance)
at BondingBroker.frmWIPAnalysis.WIPAnalysisToolStripMenuItem_Click(Object sender, EventArgs e)
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3082 (QFE.050727-3000)
CodeBase: file:----------------------------------------
BondingBroker
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:----------------------------------------
Microsoft.VisualBasic
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
System.Runtime.Remoting
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
System.Data
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3082 (QFE.050727-3000)
CodeBase: file:----------------------------------------
System.Data.DataSetExtensions
Assembly Version: 3.5.0.0
Win32 Version: 3.5.30729.1 built by: SP
CodeBase: file:----------------------------------------
System.Core
Assembly Version: 3.5.0.0
Win32 Version: 3.5.30729.1 built by: SP
CodeBase: file:----------------------------------------
Microsoft.VisualBasic.PowerPacks.Vs
Assembly Version: 9.0.0.0
Win32 Version: 9.0.30729.1
CodeBase: file:----------------------------------------
PeerAssist_BondingInformation
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
System.Transactions
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
System.EnterpriseServices
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
CrystalDecisions.CrystalReports.Engine
Assembly Version: 10.5.3700.0
Win32 Version: 10.5.0.1943
CodeBase: file:----------------------------------------
CrystalDecisions.Shared
Assembly Version: 10.5.3700.0
Win32 Version: 10.5.0.1943
CodeBase: file:----------------------------------------
CrystalDecisions.ReportAppServer.CommLayer
Assembly Version: 10.5.3700.0
Win32 Version: 10.5.0.1943
CodeBase: file:----------------------------------------
CrystalDecisions.ReportAppServer.DataSetConversion
Assembly Version: 10.5.3700.0
Win32 Version: 10.5.0.1943
CodeBase: file:----------------------------------------
CrystalDecisions.ReportAppServer.ClientDoc
Assembly Version: 10.5.3700.0
Win32 Version: 10.5.0.1943
CodeBase: file:----------------------------------------
CrystalDecisions.ReportAppServer.DataDefModel
Assembly Version: 10.5.3700.0
Win32 Version: 10.5.0.1943
CodeBase: file:----------------------------------------
CrystalDecisions.ReportAppServer.Controllers
Assembly Version: 10.5.3700.0
Win32 Version: 10.5.0.1943
CodeBase: file:----------------------------------------
CrystalDecisions.ReportAppServer.ReportDefModel
Assembly Version: 10.5.3700.0
Win32 Version: 10.5.0.1943
CodeBase: file:----------------------------------------
CrystalDecisions.KeyCode
Assembly Version: 10.5.3700.0
Win32 Version: 10.5.0.1943
CodeBase: file:----------------------------------------
System.Web
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3082 (QFE.050727-3000)
CodeBase: file:----------------------------------------
crdb_adoplus
Assembly Version: 10.0.3300.0
Win32 Version: 10.5.0.1943
CodeBase: file:----------------------------------------
msvcm90
Assembly Version: 9.0.21022.8
Win32 Version: 9.00.21022.8
CodeBase: file:----------------------------------------
CustomMarshalers
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
CrystalDecisions.Enterprise.InfoStore
Assembly Version: 10.5.3700.0
Win32 Version: 10.5.0.268
CodeBase: file:----------------------------------------
System.Web.Services
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
CrystalDecisions.ReportSource
Assembly Version: 10.5.3700.0
Win32 Version: 10.5.0.1943
CodeBase: file:----------------------------------------
CrystalDecisions.Enterprise.Framework
Assembly Version: 10.5.3700.0
Win32 Version: 10.5.0.268
CodeBase: file:----------------------------------------
AxInterop.AcroPDFLib
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
|
|
|
|
|
From the stack trace, your code is running under the 64-bit runtime. It would appear that the Crystal Reports runtime you have installed is the 32-bit version. Since you cannot combine 64 and 32 bit code in the same process, you can get funny little issues like this. I don't use Crystal Reports, so I don't know if there is a seperate 64-bit installation for the CR runtime.
|
|
|
|
|
I have installed the Crystal Runtime Library for 64bit and recieve the same error.
|
|
|
|
|
Well, it looks like the app is still using the x86 version of Crystal Reports. Try forcing the app to compile as 32-bit (x86) instead of "CPU Any" and see what happens.
|
|
|
|
|
From what I've been reading, CR's support for 64-bit is wacky. Take a look at this[^] fine little example, which may solve your problem. And people wonder why I never use Crystal Reports...
|
|
|
|
|
Your right it is a 32-bit to 64 bit issue.
The issue is more dealing with
Me.AxAcroPDF1.src = frmWIPAnalysis.fileName
Adobe Acrobat pdf viewer.
Does anyone have an alternative I could use to view pdf in both 32 and 64 bit environments.
|
|
|
|
|
I don't know of any that are "dual mode" (to make up a word).
I think you're going to have to have two different libraries in your installed, one 32-bit, the other 64, and install which ever one is appropriate for the platform in question.
|
|
|
|
|
I have a data page header,details and and footer section of crystal report 10. I want to duplicate these sections on the same page so that the same data will be contained on each of these sections and finally printed on a single paper. so that user can finally cut the paper into two pieces. Is that possible to do so or any other solution to this problem
any one with help?
with regards,
|
|
|
|
|
Hmm ...
If your main report is nothing but a container for 2 sub-reports and each sub-report has the same definition, then I think you will achieve your goal.
Give it a try. The only problem you may have is that you might need some sort of dataset to be bound to the main report; it should be a single value.
Give it a try. I've used it to produce a single page with 3 cross-tab reports on it; each cross-tab was a sub-report.
david
|
|
|
|
|
Hi David,
Thanks for the reply. I am using stored procedures that require three parameters from the its caller. Based on the data supplied to the stored procedure data will be generated from various table. Can u give me some hint on how to do so using sub-reports. here is my sample code for calling stored procedure to generate report.
dim rpt as new myreportname
rpt.SetParameterValue("@studid", DataGridView1.CurrentCell.Value)
If ComboBox3.SelectedItem IsNot Nothing And TextBox3.Text IsNot Nothing Then
rpt.SetParameterValue("@term", CInt(ComboBox3.SelectedItem))
rpt.SetParameterValue("@academicyear", TextBox3.Text)
GradeReportForm.CrystalReportViewer1.ReportSource = rpt
GradeReportForm.StartPosition = FormStartPosition.CenterParent
GradeReportForm.WindowState = FormWindowState.Maximized
GradeReportForm.CrystalReportViewer1.PrintReport()
Else
MsgBox("Please Set Term and Academic year to Generate Report")
End If
I am grateful for any help you may give me.
with regards,
|
|
|
|