|
Well, Im just looking for some guidelines, as my VB.NET book does not cover .NET Remoting. The example they give is so simple and i have tried searching the net, with no luck.
|
|
|
|
|
In that case, don't get stuck at the title of the assignment. Look at the specifications.
In other words, (apparently) you need to make a console program that takes a string parameter (path to a text file) and returns the contents of that file to the screen.
So:
1. look into console programming. For example just start a new console project in Visual Studio.
2. Figure out how you can pass parameters to a console program. For example look into command line arguments.
3. figure out how to find a file and read from it. For example look into System.IO and the StreamReader class
4. Use Console.Write or Console.WriteLine to return the content of the file to the screen.
My advice is free, and you may get what you paid for.
|
|
|
|
|
Your spec's don't have anything to do with Remoting. All you're doing it taking a filepath as a command line argument, opening that file and reading it into a String, then using Console.WriteLine to write that string out. .NET Remoting is WAY overkill for such a simple assignment.
BTW, there's nothing in this code that would not have been covered in the chapters of the book you're using up to this point. So, if you're in Chapter 5, the answer is not going to be in Chapters 6 and above.
|
|
|
|
|
Thanks alot, I know Remoting makes it way overkill, but they asked us to do it in remoting, I can easily get this doen trough console alone. The thing is My VB.NET book does not really cover Remoting in advance. the example they give is simple and does not really explain anything in detail. But thanks alot anyway guys. Appreciated alot.
|
|
|
|
|
OK, then start Googling for ".net remoting tutorial". You'll find thousands of them. Your remote component would just need the filename to read (a string obviously) and return the contents of that file (another string). There's nothing too difficult in there.
|
|
|
|
|
Hi all,
i create vb.net dll and tlb file and i useed it as reference in vb6, in the vb6 code i wrote :
Dim MyObj As New DllName.ClassName
this statment run correct and return result, but when i wrote :
Dim MyObj as Object<br />
Set MyObj = CreateObject("DllName.ClassName")
there is error accour can't create active x component
I want to if i can use late binding rather than early binding.
Thanks for help
|
|
|
|
|
Pretty sure that should work. You did register the .tlb right?
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Thanks for reply
yes i did, and when i search about it in the registry i found it, so i want to know why createobject didn't work
|
|
|
|
|
I tested this with a FTP assembly I have. In the .Net project, I checked "Register for COM interop" and added the following attributes to the class:
<classinterface(classinterfacetype.autodual)> _
<progid("ftpdotnet.clsftp")> _
Public Class FTP_Client
Compiled the project. Copied the .dll and .tlb to win\sys32. Registered the .dll with regasm (regasm FTPDotNet.dll /tlb:FTPDotNet.tlb /codebase
Added a reference in VB6 to the .tlb. Used this code in VB6 and everything was peachy:
Dim o As Object
Set o = CreateObject("FTPDotNet.clsFTP") 'Note: I am only using the progID specified above.
o.Server = "test"
o.UserName = "blah blah"
If you're still having errors, verify you have *simple datatypes* being exposed. With the .Net command, navigate to the directory with the .dll and .tlb are and register them as above.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Thanks alot for your help
|
|
|
|
|
Then name you see when you try the first method is not the same name you use with GetObject. The filename of the DLL has no bearing on the AppId you use with either. It just so happens that the filename is, apparently, equal to the namespace name you should be using. Without seeing your code, I'm guessing that your AppId string might be something like "MyDllName.MyDllName.SomeObjectName".
|
|
|
|
|
Thanks for help
from where can i know my AppId, or this is default name as you wrote MyDllName.MyDllName.SomeObjectName
|
|
|
|
|
Just a quick question - is it considered bad practise to open a user interface form from an instance of an object? The reason I ask is because that in the future the classes which I am developing may be used for web applications in which case trying to open the user interface would fail.
Thanks for your time.
|
|
|
|
|
Liqz wrote: is it considered bad practise to open a user interface form from an instance of an object?
If you're talking about a business or data layer object, then yes, it's bad practice. These objects should never put up any kind of user interface. First, it's not their job to do so. Second, it makes those objects only usable in a ASP.NET or Windows Forms application. If you wanted to add a seperate client, such as a mobile web app, to the application, you'd have to rewrite the business or data layer objects to accomodate it.
|
|
|
|
|
Just as I thought really. But thanks for the confirmation.
|
|
|
|
|
does anybody know how to take input from the text box and add it to the database ?
thank you
|
|
|
|
|
|
Yes, I do. Do you? If not, have you tried google, its a mine of information.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
How we can fetch the count of print from a particular machine to VB.Net application ?
|
|
|
|
|
Maybe using Win32_Printer or Win32_PrintJob class.
|
|
|
|
|
hi,
i have these code with temperature="TEMP(C) 37.0:\r\n"
X = InStr(1, temperature, ")")
temperature = Mid$(temperature, X + 2, 4)
After the code is excuted , will i have temperature = 37.0
Cause i execute and the value of temperature is not stable ?
Thanks
|
|
|
|
|
Hi,
Your code will extract the substring from the position given. What do you mean by the value of temperature is not stable?
Alan.
|
|
|
|
|
Actually my code is used to get the temperature of the devices . Normally the values in the range 35-39 . But sometimes i got 6 or 7... which are surely wrong ?
Thanks
|
|
|
|
|
Well that would tend to indicate that the device is returning the wrong information. Log all data to a text file and then take a look at the file to see if there is any pattern to the bad values. Your options are to fix the device, or if that is not possible to write code to ignore the bad values.
Until you know a lot more about the data that is coming from the device you can't begin to parse it reliably.
Alan.
|
|
|
|
|
Hi
Don't know if anyone can help.
I have an application running on a server that daily runs a batch of data files through itself, and updates a database with the information.
Someone has to click a 'Go' button, so there is someone monitoring it as it's running.
When I run it on my development machine I can watch the memory go up in Task Manager and then it appears that the GC kicks in and the application never reaches more than 10Mb above it's original memory usage.
When run on the Server (where many more application are running, and there is a total of 8Gb of RAM) the application just grows and grows. We don't let it get above 300Mb. We stop the job and restart it.
Does anyone know if this is OK? Is there a way of forcing the GC to tidy up? There's around 3.5 Gb memory available on the server whilst the app is running, so maybe the GC thinks 'I don't need to do anything yet'. Or maybe the app needs to take a breather or something to allow the GC time to do what it needs to do.
Hope someone can throw some light on the matter
Thanks
Jugs
|
|
|
|