|
Ah! Ok, I think (again from my bad memory) that it will crash (trying to load the reference). I didn't try this[^], but if it works, you might could check if Word is installed first. Actually, I don't have Word here so I will try it and let you know...
Update:
It hosed with: System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80040154.
I hope this is helpful and that I didn't completely miss your question. I've done it before.
modified on Monday, July 21, 2008 2:50 PM
|
|
|
|
|
Steven St. John wrote: Will the app fail to run because there is a reference to the Microsoft Word 11.0 library? Or will the app run but throw a run-time error at the "log" variable declaration?
It should work until the point of instantiating the new word application. The client computer will need to have Office 2003 or newer installed in order to work.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
The JZ - That link you gave on the Registry function was very helpful!
Paul Conrad - The info you gave me was just what I was looking for, with the bonus info that a Word 2007 user would also be able to run things.
So, this should work:
Public Class SolutionLog
Dim log As Word.Application
Dim m_WordVer As String
Dim m_CanUseWord As Boolean
Public Sub New()
Dim regKey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.ClassesRoot
Dim regWord As Microsoft.Win32.RegistryKey = regKey.OpenSubKey("Word.Application")
If Not (regWord) Is Nothing Then
Dim regWordVer As Microsoft.Win32.RegistryKey = regWord.OpenSubKey("CurVer")
m_WordVer = regWordVer.GetValue("")
If m_WordVer = "Word.Application.11" Then m_CanUseWord = True
Else
m_WordVer = "Word Not Installed"
m_CanUseWord = False
End If
End Sub
When my program creates an instance of the SolutionLog class upon loading, the registry is checked and m_CanUseWord is set if and only if Word is found and uses Version 11 (I'll add Version 12 to this eventually, and possibly parse the string and use a >= logic). I'll make this value and the m_WordVer value available to the client program as ReadOnly properties. The methods that start Word and type to Word can be error trapped:
If Not(m_CanUseWord) Then
Throw New Exception
Else
log=New Word.Application
End If
The only reason it might not work is the first line:
Dim log As Word.Application
Does that cause an error? Or will it be okay since I never actually create a new Word.Application except in an error-trapped if... then? Since the code is already compiled when it gets to the user's machine, I'm assuming this will not cause an error and my problem is solved.
If I'm Right Then
Thank you all very much!
Else
There must be some way to do this
End If
|
|
|
|
|
Hiii
i want to add a task in windows task scheduler using vb.net 2005.
how i do this.please suggest.
Thanx
~Khatri Mitesh
|
|
|
|
|
|
|
Odd question of the day: Can you have multiple font colors in same text on single statusstriplabel?
I have a status strip with multiple statusstrip labels. I want to produce something like this:
Refresh ("R" displayed as the color Red and "efresh" in black). I tried creating 2 different status labels, but the text is displayed to far apart (even after modifying the alignment and padding). So is it possible to have multiple fonts assigned to different sections of the text within the same label?
I told you..... it's an odd question
|
|
|
|
|
That is not possible with the label control of the System.Windows.Forms namespace. You can create a control that could emulate this and then embed the custom control in the status strip, but other than that I am not aware of any other ways around it.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|
|
|
You should look to use a Rich Text Box control and embed that onto your status bar control
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
Got it handled, thanks guys.
modified on Tuesday, July 22, 2008 11:22 AM
|
|
|
|
|
Hi !
I have an object named RemoteDb that is implemented as a web service.
It has a method named RemoteSql than accepts an input string and returns a system.data.datatable with the results.
I've been working for a few days referencing it from VB and all works fine. This morning I have done some modifications to webservice and so, i have rebuilt it.
From explorer, it continues working fine, but when I've updated the web reference from my applicaction (Vb.net IDE), this error has appeared:
Value of type 'RegantsAlgerri.WebReference.RemoteSqlResponseRemoteSqlResult' can not be converted to 'System.Data.DataTable'.
When i call the webmethod RemoteSql() .net environment explains me that return parameter is RegantsAlgerri.WebReference.RemoteSqlResponseRemoteSqlResult. In previous version (before update Web Reference) .net environment tells me that return type was System.Data.DataTable.
Why reference is loaded with this bad return type ?
Regards in advance
|
|
|
|
|
Well its Difficult to say, especially if we dont see the code. but i think you have tempered with the return type when you were doing modification this morning. Lets see how you wrote your function that return that datatable and we can point where the Problem is.
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Hello again,
Next description is more aproximated about problem is:
I created a Web Service using .Net 2.0 that has a function that
returns a DataTable. I can test the function from the web page when I access
the .asmx from a browser on localhost and it works.
The problem I have now is when using VS 2005 or VB.Net 2005 Express and creating a web references is
that the proxy created doesn't map the function as returning a DataTable
instead returns some other type of object named xxxxResult where xxxx is the
name of the web service function.
I have another function that returns a DataSet that works perfectly with the web reference although I'd rather use a DataTable since I won't need all the functionality that a DataSet brings.
Anyone have the same problem and found a solution?
|
|
|
|
|
Still until you show us the code, we will not know what is the problem, try to post your code
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Using DataSet and not DataTable as method argument and/or return type, the client application recognizes de types, and so it works.
I've looking other forums, and other people has the same problem.
Solution has not been found, but everybody is using DataSet vs. DataTable.
Microsoft exposes this article, recommendating using DataSets:
http://support.microsoft.com/kb/306134
|
|
|
|
|
Its True , you have to return a dataset.but you must filter it, dont return everything, because you might return a large sum of data that might not be needed by your application and consume a lot of resources
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
I build a minimal dataset:
Dim Ds as new DataSet
Ds.Tables.Add(MyTable)
return(Ds)
Thanks for your patient.
|
|
|
|
|
Thats Fine,
what you did is good.
Rememmber Patience is better than Pride, am glad you got your solution rate my post
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Hi,
In my application i have to open a new window and then to do some calculation and then to show that value on parent window.
thanks in advance
|
|
|
|
|
Hello,
You can try the given solution.
Lets say we have two forms Form1 and Form2.
In form2 we define a function which takes the Form1 as argument.
Form1 _frm;
Public Sub ShowForm(ByVal frm As Form1, ByVal img As Image)<br />
<br />
_frm = frm<br />
Me.Show()<br />
<br />
End Sub
Lets say we will return a value of type integer to Form1. For that we will have to define an integer
variable in Form1 and a Property for that variable to set its value.
Dim _val As Integer<br />
<br />
Property Val() As Integer<br />
Get<br />
Return _val<br />
End Get<br />
Set(ByVal value As Integer)<br />
<br />
_val = value<br />
End Set<br />
End Property
On Button Click in Form 1 we will open the Form2 in the following manner:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
<br />
Dim frm As New Form2<br />
frm.ShowForm(Me)<br />
<br />
End Sub
Now in FormClosing of Form2, we will set the value.
Private Sub Form2_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing<br />
<br />
_frm.Val = 2<br />
<br />
<br />
End Sub
I hope this helps.
Regards,
Allen
Allen Smith
ComponentOne LLC
www.componentone.com
|
|
|
|
|
As part of an Order System, I am wanting to email to the supplier the order,(held as two sheets), in PDF format.
'Email The Order
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
"C:\DOCUME~1\David\LOCALS~1\Temp\" & strFileName & ".pdf", Quality:= _
xlQualityStandard, IncludeDocProperties:=False, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Application.Dialogs(xlDialogSendMail).Show
'Get Back to Front Page
As far as I can tell, this ought to do the job, but it still emails the thing as a .xlsm
Am I missing the plot?
The main workbook has many pages, I merely save the two pages of the order as a seperate .xlsm file and whilst still active, email as a .pdf file.
Major Puzzlement ensues!
Any Suggestions?
------------------------------------
"I want you to imagine I have a blaster in my hand" - Zaphod Beeblebrox.
"You DO have a blaster in your hand" - Freighter Pilot
"Yeah, so you don't have to tax your imagination too hard" - Zaphod Beeblebrox
|
|
|
|
|
How to autostart up my vb application inside the system registry without "The specified RegistryKeyPermissionCheck value is invalid"
i have created and experimenting a vb2005 win application which i need to auto start up when windows run.. so programmatically i have a code communicating in the system registry?? i can read from HK_LocalMachine SubKey's and KeyName and KeyValue's but then when my application attempt to create/write a KeyName with it's corresponding KeyValue?? this give an error like this:
The specified RegistryKeyPermissionCheck value is invalid
Parameter name: mode
microsoft.win32.registrykey.validatekeymode(registrykeypermissioncheckmode)
'********** here's my experiment vb code reading and creating KeyName/KeyValue in the windows start up... i've just learned this from other post...
'******************
<br />
<br />
Imports System.IO<br />
Imports Microsoft.Win32<br />
Imports System.Security.Permissions<br />
<br />
Public Class MySampleApplication<br />
Private Sub CreateKey()<br />
Dim regKey As RegistryKey<br />
Dim KeyName As String = "MySampleApplication"<br />
Dim KeyValue As String = "C:\MySampleApplicationFolder"<br />
<br />
regKey = Registry.LocalMachine.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True, Security.AccessControl.RegistryRights.SetValue)<br />
<br />
If regKey.GetValue(KeyName) = Nothing Then<br />
'if there's no KeyName yet? then create and set it's value<br />
MsgBox("No value found")<br />
regKey.SetValue(KeyName, KeyValue, RegistryValueKind.String)<br />
MsgBox("key " & KeyName & " has been created")<br />
Else<br />
'if KeyName is already existing? then verified it KeyValue<br />
MsgBox("Value Found")<br />
If regKey.GetValue(KeyName) = KeyValue Then<br />
'if KeyName is already existing and KeyValue is the same? DO NOTHING<br />
MsgBox("value equal")<br />
Else<br />
'if KeyName is already existing but the KeyValue is diff from the original? then remodified to it's original path..<br />
MsgBox("value not equal")<br />
regKey.SetValue(KeyName, KeyValue, RegistryValueKind.String)<br />
MsgBox("key " & KeyName & " value has been remodified and back to its original application path")<br />
End If<br />
End If<br />
Catch ex As Exception<br />
MsgBox(ex.ToString)<br />
End Try<br />
End Sub<br />
End Class<br />
'****************************
Please anybody there who have any good idea with this??? im just newbie in registry manipulation using VB2005.. please forgive me from being ignorant.. im just trying to level up my programming skills...
Please any body help please??.... it's urgent.. i need this in my programming project case study...
modified on Monday, July 21, 2008 4:54 AM
|
|
|
|
|
Leave off the Security.AccessControl.RegistryRights.SetValue in the regKey = Registry.LocalMachine.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True, Security.AccessControl.RegistryRights.SetValue) line.
Please don't say it's urgent. It's a given because everyone thinks their question is urgent.
|
|
|
|
|
I have a question about your code. I inserted it into a project of mine (using Visual Studio 2008) and it refused to compile "until there was an 'Opening Try' statement." I've scanned your code and in fact don't find a *Try* statement. Where, in your code, did you or do you plan to place the *Try* statement?
David
|
|
|
|