|
I have written a small utility which works perfectly fine when it is launched from my local hard disk, but if it is run from a network location, it immediately throws the following error:
Common Language Runtime Debugging Services
Process id=0xd74 (3444), Thread id=0xcb8 (3256)
Click OK to terminate the application
Click CANCEL to debug the application
As a VB.NET newbie, I don't know how to catch this - or even better - make it run from the network location.
Any advice is really appreciated.
|
|
|
|
|
One of the things that you can do is adjust the security settings in the client computer.
In Administrative tools\Microsoft .Net Framework 1.1 Configuration and adjust the Local Intranet Zone Security.
Hope it helps
|
|
|
|
|
Hi All,
I'm generating a fileName based on the current date/time and would like to simply prepend leading zeros to the month, day, hours, minutes, and seconds if they're less than 10. This seems so simple and yet I haven't seen a function to do it (in VBScript).
Of course, I could write my own, but I'd rather not if MS provided one that I've just missed. Do any of you know if this already exists?
In VB6, I would just write something like:
strFinal = Format( nNum, "00" )
In C/C++, something like:
sprintf( strFinal, "%02d", nNum );
(Please forgive any synatx errors...it's been a while since I wrote C )
Any help is greatly appreciated.
Thanks!
Justin
|
|
|
|
|
Yeah, VBScripts formatting leaves much to be desired. But, there is a very easy solution to the problem.
Function FLZ(length, number)
Dim temp
' Generate a string of zeros the length we need, then append the number
' length = 5 and number = 232 would be "00000232"
temp = String( length, "0" ) & number
' Grab the length of the string we need to return
' length = 5 would return "00232"
FLZ = Right( temp, length )
End Function
Now all you have to do is call this for each number you want to format:
Filename = FLZ(2, Month) & FLZ(2, Day) & "-" & FLZ(2, Hour) & FLZ(2, Minute) & FLZ(2, Second)
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks, Dave! That works perfectly and you saved me the hassle (albeit minor ) of writing it myself. Much appreciated.
|
|
|
|
|
I have a windows form application written in VB.NET 2005 which opens Excel, imports a text file into a worksheet and e-mails it to the end-user.
Everything works fine when it is on my own system, but when I put the executable file on the server along with all the other files in the bin\release folder, I get the following error:
HPtoExcel has encountered a problem and needs to close. We are sorry for the inconvenience.
I had the following references in my program and it ran fine on my system:
Microsoft Excel 11.0 Object Library
Microsoft Office 11.0 Object Library
Microsoft Visual Basic for Applications Extensibility
I added the following references and still receive the error:
Microsoft.Office.Tools.Common
Microsoft.Office.Tools.Excel
Microsoft.VisualStudio.Tools.Applications.Runtime
OLE Automation
The server does not have Excel on it, but my system does. I'm double clicking on a shortcut on my desktop to the exe on the server. Is there a way to get around loading Excel on the server?
Any help is appreciated.
Lost in the vast sea of References
Lost in the vast sea of .NET
-- modified at 14:14 Monday 6th March, 2006
|
|
|
|
|
KreativeKai wrote: The server does not have Excel on it
There's your problem!
KreativeKai wrote: Is there a way to get around loading Excel on the server?
No, there isn't. How is your server code going to call Excel if it's not installed on the server?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I called Microsoft using one of our MSDN incidents. Basically Office is designed for interactive usage and they do not recommend automating it with an unattended application. Like you said, you need to have Excel installed, but they do not support Office being installed on a server because it is not designed to work on a server and cause unexpected results.
Here is a link showing their “Not supported” statement and their “at your own risk” workarounds:
http://support.microsoft.com/?id=257757
I used the workaround towards the end of the article related to “How to configure Office applications to run under the interactive user account” and I put the application on a client PC using scheduled tasks instead of on a server.
Thanks for you help Dave!!
Lost in the vast sea of .NET
|
|
|
|
|
Hallo, I'd like to to get help on the following subject:
I use a BackgroundWorker control in a form and i'd like to show intermediate results from the BackgroundWorker in a control on the same form (before it has finished its work). I tried accessing the control by reference but an exception occurred stating that the control's property (Text) cannot be changed from another thread.
thank you.
|
|
|
|
|
Make an event to which your form that will display the progress will listen.
And then fire that event from the working thread whenever you wan't to update the status (you can pass the status information in the event arguments)
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
It's correct. You can't access UI controls from any other thread other than the one that created the control (known as the UI thread).
The BackgroundWorker exposes a ProgressChanged event that you can use to update your controls. Of course, your worker code has to be able to send some kind of usuable progress!
' Setup the BackgroundWorker object and start the work somewhere...
BackgroundWorker1.WorkerReportsProgress = True
BackgroundWorker1.WorkerSupportsCancellation = True
BackgroundWorker1.RunWorkerAsync()
Private Sub BackgroundWorker1_DoWork(ByVal sender As Object, ByVal e As DoWorkEventArgs) Handles BackgroundWorker1.DoWork()
' Get a reference to the BGW that called this
Dim bgw As BackgroundWorker = CType(sender, BackgroundWorker)
' Do some long running task about a million times...
For I As Integer = 1 to 1000000
' Check to see if we've been cancelled
If bgw.CancellationPending Then
e.Cancel = True
Exit For
End If
' Do something useful here...
bgw.ReportProgress(i / 10000) ' Reduce i to the range of 0 to 100.
Next
e.Result = whatever ' Return whatever the result of this work is supposed to be.
End Sub
Private Sub BackgroundWorker1_ProcessChanged(ByVal sender As Object, ByVal e As ProgressChangedEvent) Handles BackgroundWorker1.ProgressChanged
' Do something usefull with the progress
ProgressBar1.Value = e.ProgressPercentage
End Sub
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thank you for your answer, it was really helpful.
|
|
|
|
|
Hello. I'm writing a program to store passwords. I would like to allow the user the option of sending the username and passwords to the website by just clicking a button. Can anyone help me? Thanks in advance.
|
|
|
|
|
In most cases, you can't do that. You'll have to load the login page, find (NOT EASY!), then fill in the fields with the data, then submit the login page back to the server. You can't just send a username and password to the web server and expect it to work. It just doesn't work that way.
On top of that, this is already built into Internet Explorer...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-- modified at 14:52 Monday 6th March, 2006
|
|
|
|
|
Okay I realize this is probably quite an easy questions however it has me stumped right now. I am trying to use a rich text box to display output data in three columns. The columns are lined up using tabs and everything looks great on the screen. The problem is when I go to print the data all of my tabs are lost! I have used vbtab and chr(9) coding. I don't want to hard code spaces since that way is very unpredicable and can cause problems if the font every gets changed.
Can someone please explain what the hell I am doing wrong?
Thanks
|
|
|
|
|
That depends on how you're printing the contents of the box... An explaination of how you're doing this might help.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am using the PrintDialog tool right out of the box from Visual Studio same as I am doing for OpenDialog, PrintPreviewDialog, etc.
Maybe a better explanation is that I am using a for next loop to write two arrays of data to the rich text box. After each element I insert a number of tabs so that I end up with columns of data (there are three columns in total). Like I said in my original message the form looks fine when it is run. When I go to print or use print preview all of the data is squished together. For some unknown reason (at least to me) my tabs have been removed.
|
|
|
|
|
Your tabs are getting reduced down to the size of a single space character, since in GDI+, they don't have a width, and there is no such thing as a tab stop. Printing with the PrintDialog, and the other objects you're using, isn't WYSIWYG. If you really need to do this in a RichTextBox, you'll have to modify the RTB by creating your own, supplying all the formatting and printing code.
Fortunately for you, someone ahs already done this, here[^]. I hope it works for you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks Dave. I'll read through the article you pointed me to and see if this helps.
|
|
|
|
|
could someone tell me how i could link forms together such as if i click a botton on one form the another form would open up.
-- modified at 10:34 Monday 6th March, 2006
|
|
|
|
|
You would have a click event handler for the button, and that code would create an instance of the second form and call ShowModal on it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
how do i get the event handler
|
|
|
|
|
Well, I would respond with a bit of general advice. More so than ever, there are people downloading VB Express, looking at the IDE and deciding they can write a windows program. Most of these people will fail. If you want to learn to code, you need to learn the language before you play with it's frameworks, write console apps before windows apps. It seems to me that it's likely you're at this level, and should take a step back.
The easiest way to create an event handler for a button is to double click on it in the design view.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Stop, backup, and learn the basics[^] before you beat us to death with easy questions.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I've been trying to implement the autocomplete functionality on Pocket PC application but I can't get arround the framework restriction.
Can anyone help?
Thanks.
|
|
|
|