|
I would like to use a global DLL that could be called by any program in the app. In VB6, all I had to do is create a code module which inited the DLL variables, some of which come from the database. I am migrating this app with new features to C# and have been unsuccessful in getting my ALLINFO.DLL to be availabe. Can anyone help me with this?
Thanks
David
|
|
|
|
|
Hello
drdavef wrote: called by any program in the app
What is a program?? What is an app??!!
drdavef wrote: and have been unsuccessful in getting my ALLINFO.DLL to be availabe
Why? What is your problem exactly??
In C# you make a new project for your dll, and in other projects in the solution, you make a reference by project to the dll -look for the project tab in the reference dialog-.
Regards
|
|
|
|
|
What i mean by a program is an executable that will do a variety of tasks. When I say app, I mean the entire application, which consists of 15-25 programs and a number of DLLs.
I want a DLL, that I call AppInfo, which contains general info that all programs need access to, such as SchoolYear. The application is involved with schools and school services. One thing it tracks is the type of student involved in the school year, is the student a Senior, Undergrad, or Postgrad (college). This is a toggle that the user of a given program will select to determine functionality for each type of student. This AppInfo DLL also contains functions specific for client specifications. For example, a rounding function that always rounds to the next nickle (no pennies wanted ).
I am looking for a way to create this DLL such that initialization is very simple. I used to simply call the AppInfo.Init from Main to set it up. I have not found a way to create a DLL that is available to all program functions. A program may consist of many forms and support DLLs.
Thanks for any support
David
|
|
|
|
|
Hello
I've posted the way that is used to make dlls in C# in my previous post! Is that what you want?
drdavef wrote: I want a DLL, that I call AppInfo, which contains general info that all programs need access to, such as SchoolYear
I thought SchoolYear should be stored as a variable, and since you are a programmer you know about scope. How would you store a variable in another module?!! Even in VB I don't think that's possible!!
drdavef wrote: I am looking for a way to create this DLL such that initialization is very simple.
Well, I haven't worked much in VB, but I've spent a lot of time in C# and I've never heard of Dll init!! dlls are referenced, not intitialized, specially that you are writting these dlls. I have a feeling somehow I still don't get you!! Please forgive me for that
Another approach to store shared info in an executable is to make it as a win service. I don't think that's what you want, is it?!!
Anyway. The way I know it, you want dll it's simple. Make a dll project and reference to it in other projects. You want shared info, store them in a file -careful here for read/write operations- or use a database!!
If you managed to store variables in a dll, and share it with other programs, I beg you to write an article about it.I'll be dying to read it
Regards
|
|
|
|
|
Hi,
I'm very new in programing, I create a report in Crystal reports and I want to call it from my project in sharp develop.
Somebody could me explain step by step what things I have to do?
I'm using sharp develop 2.0.0 Build 1591.
Thanks
|
|
|
|
|
Hi,
We have a function which parses csv into datatables written in C#
Want to use this function in my VB.net code. How would we go about doing this? I tried using the function name nd it doesn't seem to work, it comes back with swiggly lines. using VS 2005.
thanks.
|
|
|
|
|
Your best bet would be to give up the whole VB.NET thing and go with C#
If the function is in an assembly that you have included in your project, then you should be able to use it within you VB.NET code by instantiating an instance of the class and calling the function.
only two letters away from being an asset
|
|
|
|
|
we should be able to use either without issues - .cs and .vb
|
|
|
|
|
You can, but not the way you are trying.
only two letters away from being an asset
|
|
|
|
|
Just add a reference in your VB.NET project to the dll containing the C# function. In your VB.NET code, you'll can then call the C# function as if it were written in VB.NET.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Dumbest. Movie. Title. Evaaar.
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
it is not a separate project. I am adding this .cs file into a vb.net project.
this .cs is reading a csv file and returning a datatable.
Thanks.
|
|
|
|
|
Sorry, that won't work. A project must be entirely in one language. If you need to use multiple languages, use multiple projects in a single solution.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Dumbest. Movie. Title. Evaaar.
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
That won't work; you have to create seperate projects. You cannot combine different languages in the same project. You can, however, combine projects of different languages in the same Solution. Your C# code would have to go into it's own Class Library project, then in your VB.NET project, add a reference to the C# project.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hello!
I'm trying to do some P/Invoke, but the native DLL is an optional component, i.e. it isn't sure that it is present.
How can I test if P/Invoke will be able to call the DLL?
Best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Can you test the DLL's existence before calling DllImport()?
Best,
Jun
|
|
|
|
|
Well, I'd need to search in several directories (system directory, application directory, etc.), and even if I find a DLL it's not sure that this DLL is really a valid library (could be a text file for example)...
Isn't there any way to test if a loadable DLL is present?
Best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
As far as I know, there is no way to test if a DLL is loadable, except for catching exceptions when DllImport fails.
Best,
Jun
|
|
|
|
|
You might want to look into trying to load the .DLL using the Assembly class. You might also want to look into doing this in a seperate AppDomain so you can unload it.
-- modified at 12:07 Friday 25th August, 2006
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
No there is not. You could do interop to DllLoadLibrary to see if you can load the DLL this way. If it fails then the dll is not present.
Deus caritas est
|
|
|
|
|
Hi,
I have a bit of situtation here..
I have to check whether the current time is between two pre-defined time values. But, if the second time value is less than the first, then the second time value must be assumed of next day and then current value should be compared. Details are as below ---
time t1 = 10.00.00 PM
t2 = 11.00.00 AM
Current time should be between these two. But as shown above t1 > t2, in this case i want to assume that t2 will be time of next day. (current day +1). And after these considerations i want to find out whether current time is between these t1 and t2.
Actually i am trying to replicate the night duty schedule. If the current time is between the night timings then some operation must be performed or if it is not between the office timings then the operation will be discarded.
Hope i am clear with the situation !!
Please reply as soon as possible.
<marquee>"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
Anant Y. Kulkarni
|
|
|
|
|
try this
<br />
DateTime start = DateTime.Parse("10:00:00 PM");<br />
DateTime end = DateTime.Parse("11:00:00 AM");<br />
if(end < start)<br />
{<br />
if(DateTime.Now < start)<br />
start = start.AddDays(-1);<br />
else<br />
end = end.AddDays(1);<br />
}<br />
<br />
if(start < DateTime.Now && DateTime.Now < end)<br />
{...}
-- modified at 14:48 Friday 25th August, 2006
<edit> Just came to mind that internal if else is also required so added that.
Regards
Shajeel
|
|
|
|
|
hi all,
how can i use the smtp server installed on my computer in order to send mails using it?
SmtpClient y = new SmtpClient();
>>> y.Host = "???"; //what should i write here ?
y.Send(textBox1.Text, textBox2.Text, textBox5.Text, textBox6.Text);
am i able to send mails to yahoo, hotmail, gmail or other mail servers using my smtp server ???
help me please ...
thanks in advance,
bye.
MFA
|
|
|
|
|
use SmtpMail.SmtpServer ="ur servers ip address";
rahul
|
|
|
|
|
Message Closed
modified 27-Apr-15 11:24am.
|
|
|
|
|
sorry but u cant.
i think MS prevents spam mails so.
|
|
|
|