|
Hi,
I've got a problem when I want to printpreview my excel file. Here is the code:
Dim ExcelApplication As Excel.Application
Set ExcelApplication = New Excel.Application
ExcelApplication.Workbooks.Open App.Path & _
"\..\Factures\Facture " & _
LsBxFactures.ItemData(LsBxFactures.ListIndex) & ".xls"
'here is the problem, never pass this line
ExcelApplication.ActiveWorkbook.PrintPreview False
ExcelApplication.Workbooks.Close
ExcelApplication.Quit
Set ExcelApplication = Nothing
At the problem line, nothing appear. excel is loaded in memory (seen with task manager) and VB throw an error ("waiting for component query" or something like that) when I want to do something after this
I've installed SP5, but it's still the same.
Can you help me ??
Jacques Bérard
papejack@hotmail.com
|
|
|
|
|
Is it possible to create a bad sector in a floppy disk from visual basic 6. If possible can any write the code
Thanks
|
|
|
|
|
The short answer is No.
The long answer is you have to write some kind of low level disk control software in C/C++ to do it in Windows. You'll essentially be writing a replacement device driver for your Floppy or CD Writer.
Besides, why would you want to? Copy protection is a waste of time. Just ask anyone who's ever cracked a game!
RageInTheMachine9532
|
|
|
|
|
Is it possible to use operator overloading in visual basic. I just try to do it on vb6.0 using + operator(i.e to plus with numeric number and concatenate with string number). But this does not work properly. Any idea?
---------------------CODE---------------------
Private Sub cmdDo_Click()
Dim ty
If ((VarType(Me.txtInput.Text) = vbString) And (VarType(Me.txtOutput.Text) = vbString)) Then
ty = Me.txtInput.Text & "--" & Me.txtOutput.Text
MsgBox ty
ElseIf ((VarType(Me.txtInput.Text) = vbInteger) And ((VarType(Me.txtOutput.Text) = vbInteger))) Then
ty = (Me.txtInput.Text) + Me.txtOutput.Text
MsgBox ty
Else
MsgBox "Unknow Format or mismatch data"
End If
End Sub
------------------------END CODE-------------------
Regards,
himadrish
himadrish@yahoo.com
Himadrish Laha
|
|
|
|
|
First, VB6 doesn't do true OOP and does not support operator overloading at all.
Second, the code you wrote is making an incorrect assumption about the VarType function. VarType will return the Type of the Variable, not its contents.
Private Sub cmdDo_Click()
Dim ty
If ((VarType(Me.txtInput.Text) = vbString) And (VarType(Me.txtOutput.Text) = vbString)) Then
ty = Me.txtInput.Text & "--" & Me.txtOutput.Text
MsgBox ty
ElseIf ((VarType(Me.txtInput.Text) = vbInteger) And ((VarType(Me.txtOutput.Text) = vbInteger))) Then
ty = (Me.txtInput.Text) + Me.txtOutput.Text
MsgBox ty
Else
MsgBox "Unknow Format or mismatch data"
End If
End Sub The VarType statements of all your Text properties will ALWAYS return vbString. If you hit F2, select the TextBox control in the left pane and then the Text property in the right pane, and look at property details at the bottom of the window, you'll see that it says
Property Text As String
Member of VB.TextBox
Returns/sets the text contained in the control.
On top of that, both the '&' and '+' operators, when used with strings (.Text properties) will always append one string to another. In your code, you essentially did the same thing twice. Both 'ty=' statements will append one string to another.
RageInTheMachine9532
|
|
|
|
|
Okay, if VB6 does not support true OOP; then, what
about VB.Net? Does VB.Net support OOP.
Well, I'm not familiar with the language BASIC. I am
using+learning C++ and java all the time. And I am now
exploring the VC++.Net, so I wonder what's the difference
between VC++.Net and VB.Net, since they are both windows
programming. Do I need to understand BASIC to use VB.net?
|
|
|
|
|
VB.Net supports almost all OOP specifications. The only thing it can't do is operator overloading.
In order to use VB.NET, you better have at least a minimal understanding of at least one flavor of the BASIC language. C++ and Java are closely related and more flexible than BASIC or VB.Net as far as OOP goes. But, you get that flexibility at the expense of complexity.
The difference between VC++.Net and VB.Net? Apples and Oranges...The two languages are just that, two completely different languages. Which one you use is NOT dictated by what you want to do, but more HOW you want to do it. For instance, if your code design requires operator overloading, you'll have to use either C++ or C#. BASIC/VB doesn't support it.
But that doesn't mean that VB is useless. Like I said, your DESIGN is what dictates which languages you can use. There are ways around operator overloading if your classes are designed properly. Your classes can be designed with Add, Subtract, or Whatever operator functions you choose, designing these as overloaded functions to handle different operand cases.
RageInTheMachine9532
|
|
|
|
|
RageInTheMachine9532 wrote:
Which one you use is NOT dictated by what you want to do
I'm sorry but I disagree. If I want to write a hardware driver, I'm sure not going to use VB, nor am i going to use C++ to write a simple business app.
|
|
|
|
|
OK. That's a special purpose example. But for the great majority of apps, the design is the dictator. You project requirements are laid out and you come up with a modular design framework. Various parts of the framework are then designed and coded. The designs you come up with are going to be based on the techniques and languages you are familiar with. Sure, some languages are better suited for certain tasks than others.
You COULD write a simple business app in C++ but, your right, it is simpler in VB. Could you write a data fitting algorithm in either language? Sure! Again, it comes down to what your familiar with in languages and techniques.
Anyway, the person who posted the original question doesn't sound like he is going to be writing device drivers anytime soon. He still needs to learn the differences in languages, what their capabilities and limitations are and how to get around them when appropriate.
Just my humble opinion... But in the end, it's a combination of factors that determine the language(s) used for various parts of or for an entire project.
RageInTheMachine9532
|
|
|
|
|
VB program is not as fast as C++ and our operating system like windows and linux are written in C and C++. When writing device driver or component. It is always better of using C++. For business application and RAD which program speed is not crucial. It is okay to use VB.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
With .NET, the argument is no longer true since managed code is managed code - all .NET languages compile to IL and use the CLR - the only differences are any language-specific differences, which if the application is CLS compliant are not supposed to be used anyways.
|
|
|
|
|
Any body can help me for creating the audit log for vb form for all the activities with that form.Also Database activities should get logged.
Thanks/Regards
|
|
|
|
|
Does anyone have a solution to this problem:
When implementing a ControlDesigner or ParentControlDesigner, if one has a
UserControl that contains child controls as follows:
+========UserControl=========+
| +-----------------------------------+ |
| | Caption Panel | |
| +-----------------------------------+ |
| +---------------------------------- + |
| | Content Panel | |
| +-----------------------------------+ |
+=========================+
My desire is to have ToolboxItems that are added to the UserControl at
design-time be added as children of the ContentPanel.
- Using a ControlDesigner and invoking CreateComponent() adds the control to
the current design document (the UserControl).
- If one attempts to "re-parent" the control being "dropped" within the
designer for the UserControl by doing the following
Control target = ((myUserControl)this.Control).ContentPanel;
// the (child) Control where the dropped control should be moved-to
this.Control.Controls.RemoveAt(this.Control.Controls.IndexOf(ctl));
// remove the control from the UserControl (top-level parent)
ctl.Parent = target;
// assign the .Parent property of the control
target.Controls.Add(ctl);
// add the dropped control to the ContentPanel Controls collection
The error "Object reference not set to an instance of an object" occurs.
Do I need to create a(nother) designer for the ContentPanel so that IT can
serve as the target of the DragDrop? Is there some other (more expedient)
way to do this? Initiate an additional DesignerTransaction that makes the
re-parenting change? Making the .Parent and Controls[] change, and then
using the ComponentChangeService to make Changing/Changed notifications on
the "Parent" and "Controls" PropertyDescriptors ?
|
|
|
|
|
Sorry for my pure english.
I have created the WEB service which works with database. It works well.
Then I need to have access to this WEB service via IExplorer.
So I create the WEB client application and form on its web-page.
I send the ID value via this form to WEB service and get the answer to table below the form.
I need to obtain the query result on new separate web-page.
Question: How to do it?
|
|
|
|
|
Presumably the first page is used to get all of the parameters to use the web service. On the first page use the Page.IsPostback method to see if details have been submited. Then do a Response.Redirect or Server.Transfer to the page you want to display the results in. In the url pass the values you want to use in your webservice in the querystring. E.g. Response.Redirect("MyPage.aspx?key1=" & TextBox1.Text & "&key2=" & DropDownList1.SelectedValue. In MyPage.aspx use those values to query the web service on that page (Use Request.Querystring("key1") etc).
Jim
|
|
|
|
|
I am trying to get a number that will start at (2 digit month, 2 digit year (not visible) and 3 digit sequence number) that will automatically reset to 001 when the month changes. The number needs reference a table and go off the last number used. I have not been having any luck with it :banghead: any suggestions?
Private Sub cmd1_Click()
Set localConnection = CurrentDb()
Set rJN = localConnection.OpenRecordset("TEST")
rJN.MoveLast
Dim cMonth As Integer
Dim cYear As Integer
Dim vYear As Integer
Dim vMonth As Integer
Dim vNum As Integer
vYear = Int(Val(Left$(rJN![Test], 2)))
vMonth = Int(Val(Mid$(rJN![Test], 2)))
vNum = Int(Val(Right$(rJN![Test], 3)))
cYear = Year(Now)
cMonth = Month(Now)
If vMonth = cMonth Then
rJN = rJN + 1
Else
rJN = "001"
End If
End Sub
:help: Thanks
|
|
|
|
|
Set localConnection = CurrentDb()
Set rJN = localConnection.OpenRecordset("TEST")
rJN.MoveLast
dim dtRS as Date = rJN![Test]
If dtRS.Month = Now.Month Then
dtRS.Month = dtRS.Month + 1
Else
dtRS.Month = "01"
End If
debug.writeline (dtRS.ToString)
Have not tested this...but may be this is what u want...
Regards,
NetPointer
|
|
|
|
|
How do one restore/refresh a database connection in code, without exitting?
|
|
|
|
|
Hi all VB gurus, anyway to print a microsoft access 2000 report from a VB app? I'm using an ADO Connection interface at the minute, but I'm guessing I'll having to use another component? Thanks all who give it a go.
|
|
|
|
|
...to find the current transperancy level of the windows' taskbar. I have a function to set a specific transperancy level though the windows API, but how can I get a value of an existig, or should I say current transperancy level?
any help would be greatly appreciated.
|
|
|
|
|
Hi...
Nice to hear from u all
By the way, I'm trying to do a program to control printing.
The scenario:
I have 1 mass volume printer and 1 normal printer. The system would be able to detect the number of copies that I send and automatically assign to the correct printer. Less than 25 copies go to normal printer, and more than 25 copies go to mass volume printer.
How should I start to do this program?
What languages would be appropriate to program it ?
Please help me, I'm just a starter in programming field.
Your help would be very useful for me, and I'm very grateful to hear from u all....
thanks
regards,
wism chan
|
|
|
|
|
I have a calendar in web application vb.net.
I have a month dropdown box, a day dropdownbox and a year dropdown box.
When I select the Month, I can get my calendar to change to month but right now
have hard code at end for /1/2003. How do I get it to change for month and stay on
whatever day and year.
And then select the day I want in the dropdown box and change the day in calendar but
keep the month i just selected and year shown.
And then select the Year I want in the dropdown box and change the year in calendar
but keep month and day I just selected in other dropdown boxes?
Can't figure it out.
This is my dropdown list so for for the Month which works , but then I need it to stay
on the selected month and change for day, year. Can't figure out without hard code
at end "/1/2003" which I don't want, because day and year dropdown lists when selected
need to change for whatever I select.
PLEASE HELP!!!!! Thank you.... Alex
Private Sub ddlMonth_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ddlMonth.SelectedIndexChanged
'ddlMonth.DataValueField = Calendar1.SelectedDate.Month
Calendar1.SelectedDate = CDate(ddlMonth.SelectedIndex + 1 & "/1/2003")
Calendar1.VisibleDate = CDate(ddlMonth.SelectedIndex + 1 & "/1/2003")
End Sub
|
|
|
|
|
I have some Crystal Reports that I am using in my VB6 application that I would like to convert to .net and was wondering if I could somehow use my old reports in .Net ?
ALso, can I use my reports in the version of Crystal Reports that comes with .net or would I have to buy a package ? Which isn't goint to happen soon due to my unemployment, which is why I a asking.
Thanks
Tony
|
|
|
|
|
Hi,
I have a problem parsing a WSDL xml with an XMlDocument.
This is a short version of the XML:
<?xml version="1.0" encoding="utf-8" ?>
<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://tempuri.org/WebReferenceAddin.DefaultCustomer/CustomerEngine" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://tempuri.org/WebReferenceAddin.DefaultCustomer/CustomerEngine" xmlns="http://schemas.xmlsoap.org/wsdl/">
<types />
<message name="GetCustomerSoapIn" />
<message name="GetCustomerSoapOut" />
<message name="GetCustomerByNameSoapIn" />
<message name="GetCustomerByNameSoapOut" />
<portType name="CustomerEngineSoap" />
<binding name="CustomerEngineSoap" type="s0:CustomerEngineSoap" />
<service name="CustomerEngine">
<port name="CustomerEngineSoap" binding="s0:CustomerEngineSoap">
<soap:address location="http://localhost/webreferenceaddin.defaultcustomer/customerengine.asmx" />
</port>
</service>
</definitions>
The code I use is:
Dim dom As New System.Xml.XmlDocument
dom.Load(URL.Text)
'Create an XmlNamespaceManager for resolving namespaces.
Dim nsmgr As System.Xml.XmlNamespaceManager = _
New System.Xml.XmlNamespaceManager(dom.NameTable)
For Each att As System.Xml.XmlAttribute In dom.DocumentElement.Attributes
If att.Prefix = "xmlns" Then
nsmgr.AddNamespace(att.LocalName, att.Value)
End If
If att.LocalName = "xmlns" Then
nsmgr.AddNamespace("", att.Value)
End If
Next
When I use the commandwindow for selecting the service element I get:
>? dom.selectsinglenode("./node()[1]/service",nsmgr)
Nothing
But the statement below gives
>? dom.selectsinglenode("./node()[1]/node()[8]",nsmgr)
{System.Xml.XmlElement}
[System.Xml.XmlElement]: {System.Xml.XmlElement}
Attributes: {System.Xml.XmlAttributeCollection}
BaseURI: "http://localhost/webreferenceaddin.defaultcustomer/customerengine.asmx?wsdl"
ChildNodes: {System.Xml.XmlChildNodes}
FirstChild: {System.Xml.XmlElement}
HasChildNodes: True
InnerText: ""
InnerXml: "<port name="CustomerEngineSoap" binding="s0:CustomerEngineSoap" xmlns="http://schemas.xmlsoap.org/wsdl/"><soap:address location="http://localhost/webreferenceaddin.defaultcustomer/customerengine.asmx" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" /></port>"
IsReadOnly: False
Item: <cannot view indexed property>
LastChild: {System.Xml.XmlElement}
LocalName: "service"
Name: "service"
NamespaceURI: "http://schemas.xmlsoap.org/wsdl/"
NextSibling: Nothing
NodeType: Element
OuterXml: "<service name="CustomerEngine" xmlns="http://schemas.xmlsoap.org/wsdl/"><port name="CustomerEngineSoap" binding="s0:CustomerEngineSoap"><soap:address location="http://localhost/webreferenceaddin.defaultcustomer/customerengine.asmx" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" /></port></service>"
OwnerDocument: {System.Xml.XmlDocument}
ParentNode: {System.Xml.XmlElement}
Prefix: ""
PreviousSibling: {System.Xml.XmlElement}
Value: Nothing
What is wrong?
Thank you,
Raf.
|
|
|
|
|
Hi Raf!
You could use following XPath query:
node()[1]/*[name()='service']
For a good overview of all XPath possiblities (including interactive testing!), visit http://www.zvon.org/xxl/XPathTutorial/General/examples.html. To do some more interactive testing you can use the XPath Visualizer Version 1.4 (http://www.vbxml.com/xpathvisualizer/default.asp).
Greetz
Jan
|
|
|
|