|
I'll try it again, but last time I tried that it threw an error at the '=' and said it expected an end of statement.As for what version I am using I am not 100% sure, its the built in editor to Microsoft Office 2003.
I'll try this in the morning and pop back on here if i still can't get it working.
Thanks a bunch for the response!
--Its not broken if it never worked.
|
|
|
|
|
You're welcome. If that doesn't work, you could also try,
Dim sW As New IO.StreamWriter(pathToFile)
or
<br />
Dim sW As IO.StreamWriter <br />
sW = New IO.StreamWriter(pathToFile)<br />
I hope this helps; I haven't used the programming tools included with Office for a couple of years.
modified on Tuesday, April 1, 2008 8:47 PM
|
|
|
|
|
Hey,
I tried what you posted there and got the following error.
--Compile error:
--Expected end of statement
It happened at the first bracket of this line.
sW = New IO.StreamWriter(pathToFile)
If this were C# I would assume I hadn't included the right system file, but i can't seem to declare a system file, ie:
using System.IO
Do you know if that is the case with VB, and if so do you know the syntax for including it?
--Its not broken if it never worked.
|
|
|
|
|
Adam.m.Nelson wrote: I'll try it again, but last time I tried that it threw an error at the '=' and said it expected an end of statement.As for what version I am using I am not 100% sure, its the built in editor to Microsoft Office 2003.
AFAIK, Office 2003 uses VBA for the scripting - it probably doesn't recognise StreamWriter.
|
|
|
|
|
Oh, I didn't know that, thanks!.
Do you know of any way to write to a file while 'scripting'?
--Its not broken if it never worked.
|
|
|
|
|
You will need to use the "Basic" methods for file handling.
For example:
FileHandle = FreeFile()
Open [FilePath] for Output as FileHandle
Print #FileHandle,"This is a test string"
Close FileHandle
HTH
[Edit]Had to change since < was intepreted differently[/Edit]
|
|
|
|
|
That did it! thank you very much
--Its not broken if it never worked.
|
|
|
|
|
Adam.m.Nelson wrote: That did it! thank you very much
You are welcome.
|
|
|
|
|
Do you know if it is possible to bring up the 'Save As' window to allow the user to select the save location and file name? I got it working allowing the user to enter the location and file name in a seperate cell, but it would be handy to bring up the dialog they are use to seeing any other time they save a windows file.
--Its not broken if it never worked.
|
|
|
|
|
This dialog is implemented in the CommonDialog Windows control. You can add reference to the ComDlg32.OCX object in your script and use the methods in this object to Open / Save files. This will bring up the familiar Windows file dialog.
HTH
|
|
|
|
|
Beautiful, I will try that tonight. If its not too much to ask, I have another quick question:
This way of doing it leaves an extra cariage return at the end of the file, i tried writing a \b to the file once it is all done, but it literally writes a \b in the file.
Print #FileHandle, "\b"
Print #FileHandle, '\b' isn't a command as the ' starts a comment.
Is there a way to kill that last cariage return?
--Its not broken if it never worked.
|
|
|
|
|
The Print statements appends a CR+LF to the text... I don't know of a way you could suppress this.
|
|
|
|
|
hmm, ok, thanks anyways!!
I'll play around with it and if I figure something out I will post it here.
--Its not broken if it never worked.
|
|
|
|
|
Put a semi-colon on the end of the Print statement.
Print #FileHandle, "something...";
This will avoid adding a CRLF to the end of the line it just printed to the file.
|
|
|
|
|
Hey hey that did it!, however because i am writing to the file inside of a loop there are no line breaks now. Is there a command I can put at the beginning of the string being written to the file to tell it to create a new line?
--Its not broken if it never worked.
|
|
|
|
|
Actually, never mind, i re-worked the loop to work around it.
Thanks a bunch everyone!!
--Its not broken if it never worked.
|
|
|
|
|
Hello Friend!
I've built a windows application.
now I want to show any gif image while system is busy to save data in data base. after completing save operation the image will be invisible. again it will be visible during saving data.
How can I do this?
Please, help me.
Thanks!!!!!!!!!!
|
|
|
|
|
Use a Gif image in a picture box control, this will give you desired result.
Logic would be like this –
-----------------------------
Picturebox1.image=Image.FromFile(“OneAniImage.gif”)
SaveSomeData()
PictureBox1.image=nothing
------------------------------
I hope this helps.
-Ajay.
--------------------------
www.componentone.com
--------------------------
|
|
|
|
|
i used this logic
but the result is that- after completing the whole task i.i, saving data, the image is displayed
|
|
|
|
|
Hi,
when you modify GUI elements (Controls) inside an event handler running on the GUI thread,
the result will show only when your handler is done.
Hence the sequence show_image, save, hide_image will NOT show an image.
There are basically two remedies:
- split the sequence using either a timer (not recommended here) or a thread or
backgroundworker; this is the recommended approach
- if you are sure your handler is not reentrant (will not be called again while
running) you could include a Application.DoEvents() to let the GUI settle
before continuing with the handler's execution. If you abuse it, side effects will
hit you, with a possible stack overflow.
BTW: don't cross-post, ask your question on one forum only!
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
I'm invoking COM dll method from VB program.
COM interface method takes one of the parameter as IUnknown as below
HRESULT SetMethod([in] long samNumber, [in] IUnknown* List);
When i try to call this method from VB by passing "null" as the second parameter i get error "424 Object required."
I dont want to create a new object. Why can't i pass null as the parameter? Is there any other way without creating object? Please help
|
|
|
|
|
nilam2477 wrote: I dont want to create a new object. Why can't i pass null as the parameter?
Because the function won't let you??
nilam2477 wrote: Is there any other way without creating object?
Probably not, but that's up to the function you called. Without seeing the docs on this function, it's impossible to tell you what you can and cannot get away with.
|
|
|
|
|
Sir,
I developed an application in .net and java using corba.
My server is sun java jdk1.4.2 in linux platform.
My client is vb.net application in windows.
To link this i used iiop.net which generates a dll of the idl file .this idl is added as
reference to .net program.
I start the naming service as orbd -ORBInitialPort 1050 and then run the application as java AdderServer.
The server gets started and when I run the .net application it gives an
error message like this:
Error: omg.org.CORBA.TRANSIENT: CORBA system exception : omg.org.CORBA.TRANSIENT [Unable to connect to target.] , completed: Completed_No minor: 4000
Server stack trace:
at Ch.Elca.Iiop.IiopClientFormatterSink.AllocateConnection(IMessage msg, Ior target, IIorProfile& selectedProfile, UInt32& reqId)
at Ch.Elca.Iiop.IiopClientFormatterSink.SyncProcessMessageOnce(IMessage msg, Ior target)
at Ch.Elca.Iiop.IiopClientFormatterSink.SyncProcessMessage(IMessage msg)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at omg.org.CORBA.IObject._is_a(String repositoryId)
at Ch.Elca.Iiop.IiopClientFormatterSink.CheckAssignableRemote(Type formal, String url)
at Ch.Elca.Iiop.IiopClientFormatterSink.IsInterfaceCompatible(Ior target, Type neededTargetType, String targetUrl)
at Ch.Elca.Iiop.IiopClientFormatterSink.VerifyInterfaceCompatible(Ior target, IMessage msg)
at Ch.Elca.Iiop.IiopClientFormatterSink.SyncProcessMessage(IMessage msg)
at System.Runtime.Remoting.Proxies.RemotingProxy.CallProcessMessage(IMessageSink ms, IMessage reqMsg, ArrayWithSize proxySinks, Thread currentThread, Context currentContext, Boolean bSkippingContextChain)
at System.Runtime.Remoting.Proxies.RemotingProxy.InternalInvoke(IMethodCallMessage reqMcmMsg, Boolean useDispatchMessage, Int32 callType)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(IMessage reqMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at omg.org.CosNaming.NamingContext.resolve(NameComponent[] nameComponents)
at Linuxserver_and_Windowclients.frmMDI.StartServerToolStripMenuItem_Click(Object sender, EventArgs e) in C:\Linuxserver\Form1.vb:line 185
The code for connectivity in .net is
Private Sub StartServerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StartServerToolStripMenuItem.Click
Try
Dim nameServiceHost As String = ipAdd
Dim nameServicePort As Integer = 1050
Dim channel As New IiopClientChannel()
ChannelServices.RegisterChannel(channel)
Dim init As CorbaInit = CorbaInit.GetInit()
Dim nameService As NamingContext = init.GetNameService(nameServiceHost, nameServicePort)
Dim name() As NameComponent = New NameComponent() {New NameComponent("Adder")}
adder = CType(nameService.resolve(name), Adder)
nameService.resolve(name)
Me.tbl_server.Text = "Client connected to " & ipAdd
Catch ex As Exception
tbl_server.Text = "Error: " & ex.ToString()
End Try
End Sub
This is working if i run the client and server in two windows machines.
Waiting for u r reply.
Yoursfaithfully
M.srikarPradeep
|
|
|
|
|
Hi,
I have the problem in a larger project, however, even a simple windows program like a hello world prog leads to the same problem:
In Visual Studio.net 2005 (+VS2005-SP1, + all update as far as update.microsoft.com presents them) I created a new windows project in Visual Basic. It has one form and the form has one button. The code of the form reads:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MessageBox.Show("Button has been clicked")
End Sub
End Class
It looks like a "hello world" program . When I compile it in debug mode (with "Any CPU") and start it it shows the form with the button and a click on the button shows the messagebox. So far everything works fine.
However, when I set a break point in the line >>MessageBox.Show("Button has been clicked")<< and compile it in debug mode (with "Any CPU") and start the prog, a click on the button does not start the debugger at the break point (as I would expect), but rather causes a program crash with the message "Test_Form.vshost.exe has detected a problem and must be quit." (this my translation of the German message I get: "Test_Form.vshost.exe hat ein Problem festgestellt und muss beendet werden."); "Test_Form" is the project name and assembly name.
I recently switched from VS.net 2003 to VS.net 2005. I never had a problem like this one in VS.net 2003.
What could cause the program crash? Help is very much welcome.
Michael
PS:
The SP1 (KB926606) is already installed. The details given by Visual Studio.net 2005 are listed below. In addition I've installed "Security Update für Microsoft Visual Studio 2005 Professional Edition - DEU (KB937061)".
- - - - -
Microsoft Visual Studio 2005
Version 8.0.50727.762 (SP.050727-7600)
Microsoft .NET Framework
Version 2.0.50727 SP1
Installierte Edition: Professional
Microsoft Visual Basic 2005 [...]
Microsoft Visual Basic 2005
Microsoft Visual C# 2005 [...]
Microsoft Visual C# 2005
Microsoft Visual C++ 2005 [...]
Microsoft Visual C++ 2005
Microsoft Visual J# 2005 [...]
Microsoft Visual J# 2005
Microsoft Visual Web Developer 2005 [...]
Microsoft Visual Web Developer 2005
Microsoft Web Application Projects 2005 [...]
Microsoft Web Application Projects 2005
Version 8.0.50727.762
Crystal Report [...]
Crystal Reports für Visual Studio 2005
Microsoft Visual Studio 2005 Professional Edition - DEU Service Pack 1 (KB926606)
Dies ist ein Service Pack für Microsoft Visual Studio 2005 Professional Edition - DEU.
Wenn Sie zu einem späteren Zeitpunkt einen aktuelleren Service Pack installieren, wird dieser Service Pack automatisch deinstalliert.
Weitere Informationen erhalten Sie unter http://support.microsoft.com/kb/926606
Security Update für Microsoft Visual Studio 2005 Professional Edition - DEU (KB937061)
Dies ist ein Security Update für Microsoft Visual Studio 2005 Professional Edition - DEU.
Wenn Sie zu einem späteren Zeitpunkt einen aktuelleren Service Pack installieren, wird dieser Security Update automatisch deinstalliert.
Weitere Informationen erhalten Sie unter http://support.microsoft.com/kb/937061
|
|
|
|
|
Do this happen in every project you try or just in this one project??
|
|
|
|