|
I can't remember what I had for lunch yesterday, let alone who I talked to about what a few years ago.
Probably so, though, my position has changed on various aspects of the .NET Framework over the years. It used to be that it was suggested you called Dispose on anything implementing IDisposable, but now, that's changed. You should know WHY you're calling Dispose on an object and understand that an implementation of it may only be there to let you override it in your own inherited classes.
|
|
|
|
|
Dave Kreskowiak wrote: I can't remember what I had for lunch yesterday
Turkey leftovers with fried onion rings on the side?
Dave Kreskowiak wrote: it was suggested you called Dispose on anything implementing IDisposable, but now, that's changed.
That is horrible. It used to be simple: it is available, there may or may not be unmanaged resources involved (and that may change from one version to the next), so call Dispose().
As to the original question: wouldn't it be wise, and maybe even help, to remove the data binding first?
|
|
|
|
|
Luc Pattyn wrote: Turkey leftovers with fried onion rings on the side?
I hate onion rings... -bleck-
Luc Pattyn wrote: As to the original question: wouldn't it be wise, and maybe even help, to remove the data binding first?
Maybe. The only way to tell would be to try it. I'm just not that into testing it myself this week.
|
|
|
|
|
I am working on that path now. I tried simply setting the DataSource = Nothing for the columns, datagridview, and cells within the combobox columns. Apparently that isnt working good enough because the dispose is forcing the grid to go through and remove bindings which is raising events which is slowing down the dispose.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
Hi
I have created a .NET application with a custom installer, that all works fine.
After the installation process I need to access a file that is located inside the folder where the MSI installer / setup is located.
The problem I have is I cannot work out how to get the path for the MSI installer / setup.
Can anybody please help and advice me the best way to get this path while I am still inside the "Commmited" of the installer
vb.net or C# either will be fine.
Thanks
|
|
|
|
|
Your installer should not be accessing files from the folder that the .MSI was launched from. Any files it needs should be inside the .MSI itself.
Windows Installer, AFAIK, doesn't have a facility to tell the code inside an .MSI where it was launched from.
|
|
|
|
|
I beg to differ. We often use Active Directory to roll out updates and installs company-wide. It is a common requirement to pick up some client specific customisation data which they supply in an xml file accompanying the msi. When installing the same update across multiple clients it would be impractical to do a specific build for each client containing their special data to roll out to the end users.
|
|
|
|
|
Fair enough. We just never do that around here.
In our apps, we have client specific information in the users metadata in our databases. No need to send an XML file with each install.
|
|
|
|
|
I have to say the only bit we let them customise at this point is the webservice URL of their server. We said to them, just tell your end users what to type in when it is prompted on first run. Not an accepted, but as they say, 'the client is always right', at least until they pay the invoice.
|
|
|
|
|
Thankfully, just about all of my work in internal. I don't have very many clients on the outside and don't have to customize anything for a client before it goes out the door.
|
|
|
|
|
you can use the SourceDir property of the Windows Installer.
You can pass this info as a CustomAction in your deployment project : /SrcDir="[SourceDir]\"
You can then use it in c# with : this.Context.Parameters["SrcDir"]
or in vb with : Me.Context.Parameters("SrcDir")
|
|
|
|
|
Thank you very much, worked great
|
|
|
|
|
Hello people i have an ftp question in my application for employe monitoring i capture screen and then i upload it to server every 1 seccond for now i use this:
Uploader:
<br />
On Error Resume Next<br />
FileUploadedSuccessfuly = False<br />
Dim local_file As String = whatfile<br />
Dim remote_file As String = WORKSERVER & "/" & System.IO.Path.GetFileName(whatfile).ToString<br />
Dim cls_request As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create(remote_file), System.Net.FtpWebRequest)<br />
Dim user_name As String = "root"<br />
Dim password As String = "administrator"<br />
<br />
'Establish credentials for logging into ftp site<br />
cls_request.Credentials = New System.Net.NetworkCredential(user_name, password)<br />
<br />
'Set properties<br />
cls_request.KeepAlive = False<br />
cls_request.Proxy = Nothing<br />
cls_request.Method = System.Net.WebRequestMethods.Ftp.UploadFile<br />
cls_request.UseBinary = True<br />
<br />
'Read in the file<br />
Dim b_file() As Byte = System.IO.File.ReadAllBytes(local_file)<br />
<br />
'Upload the file<br />
<br />
Dim cls_stream As System.IO.Stream = cls_request.GetRequestStream()<br />
cls_stream.Write(b_file, 0, b_file.Length)<br />
cls_stream.Close()<br />
cls_stream.Dispose()<br />
FileUploadedSuccessfuly = True<br />
Exit Sub<br />
And Timer:
<br />
If FileUploadedSuccessfuly = True Then<br />
FileUploadedSuccessfuly = False<br />
CatchScreen()<br />
UPfile("C:\EMON\bin\tmp_" + THISPCUsername + ".jpg")<br />
End If<br />
so timer every seccond check if last file was uploaded and if it is then it grabs new picture and overwrite it and again uploading but problem is that every seccond it connects to server again from begining with pass and user name i want that it connects when i start application and stay connected and uploads same file every seccond from timer but waits until last one is uploaded successfully and if connection is droped that it reconects! thanks i tried to do that but i didnt succed for now so if u can help thanks!!!
|
|
|
|
|
First, your software is illegal if used in the United States without first warning the user you are watching them.
Second, you're design is entirely wrong for this. You're saturating the network and the FTP server with images constantly being copied to the FTP server. You're also assuming that it takes 1 second for the app to connect to the FTP server and upload the picture. This will simply not be the case all the time.
You really should be redesigning this to only capture the screens that you need to look at when you need to look at them AND not use FTP for this task. Your central monitoring app should be getting direct streams from something like VNC to minimize traffic on the network.
|
|
|
|
|
|
Member 4705584 wrote: i chose that metod becose "the boss" of company wants to check from home, office and cell phone
Just on this specification, using FTP was a poor design choice. Your implementation is MUCH slow than the "real time" provided by a VNC implementation. Also, it will only show a frame in time unless your management side implementation refreshes its image constantly.
Your design assumes that the FTP server will tolerate having a logged in connect indefinitly. You have no error checking, you're using VB6 constructs in VB.NET code, you have no methods of seeing if you actually have a good connection to the server, your code is logging into the FTP server over and over again, possibly running the FTP server out of connections. Your design also relies on a specific network configuration where you do not support proxy servers and you leave yourself open to file-based issues such as a file being written and viewed at the same time.
I can't fix this without trashing everything you have and starting over...
|
|
|
|
|
|
can annyone help me???
i need something like:
In form 1 class:
<br />
Dim FileUploadedSuccessfuly As Boolean = True<br />
Dim cls_request As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create(remote_file), System.Net.FtpWebRequest)<br />
Dim user_name As String = "root"<br />
Dim password As String = "administrator"<br />
cls_request.Credentials = New System.Net.NetworkCredential(user_name, password)<br />
cls_request.KeepAlive = True<br />
cls_request.Proxy = Nothing<br />
cls_request.Method = System.Net.WebRequestMethods.Ftp.UploadFile<br />
cls_request.UseBinary = True<br />
so that when form is loaded that it connects to server and stay connected
and then in timer:
<br />
If FileUploadedSuccessfuly = True Then<br />
FileUploadedSuccessfuly = False<br />
CatchScreen()<br />
Dim remote_file As String = WORKSERVER & "/" & System.IO.Path.GetFileName("C:\EMON\bin\tmp_" + THISPCUsername + ".jpg").ToString<br />
Dim cls_request As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create(remote_file), System.Net.FtpWebRequest)<br />
Dim b_file() As Byte = System.IO.File.ReadAllBytes("C:\EMON\bin\tmp_" + THISPCUsername + ".jpg")<br />
Dim cls_stream As System.IO.Stream = cls_request.GetRequestStream()<br />
cls_stream.Write(b_file, 0, b_file.Length)<br />
cls_stream.Close()<br />
cls_stream.Dispose()<br />
FileUploadedSuccessfuly = True<br />
End If<br />
thats all i need for now! only problem is underlined...
thx, and thanks dave , now i have to do this and then after a month or more i will go redesigning!
|
|
|
|
|
hi for all
I want use Virtual Ketboard in vb.net forms beacause my screen is touch screen
but i not found any component
please guide me
Thanks
|
|
|
|
|
If you had searched CP articles, you would have found this[^] article.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Hi d@nish Thank you For Your Reply
But I want This code in vb.net
if possible send me a dll file or component for this job
thanks
|
|
|
|
|
All you have to do is convert the code yourself. It's only C#, not rocket science. There are a ton of online code converters on the web. All you need to do is a simple search.
Or, you can just leave that component as is, compile it yourself, then use the resulting library in your VB.NET project.
|
|
|
|
|
As Dave said, either convert it yourself (lots of means available) or just add a reference to it in your code and use it.
You might have read "interoperability" as advantages of .Net framework, you can make use of that now.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
hi,
i would like to make a program in visual basic 9 to comunicate via Modbus with a PLC.
I alrady done one with vb6 but with vb9 (visual studio 2009) i can't.
The problem is this: when i make a string to send to PLC i send the byte as char but, when the byte is equal to "00" or to "01" the software don't send anything.
In vb6 this don't appened... some one can help me please?
Thanks
Joshua
|
|
|
|
|
Would the ASCIIencoding class help? it contains GetChar and GetBytes so using these you should be able to get anything you want to send to the PLC.
I am a bit confused by your question, as in what exactly you are trying to send out.
|
|
|
|