473,325 Members | 2,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Get String From DLL Visual Studio 2008

133 100+
Hi Experts,
i have created a DLL in Visual Studio 2008 Express and i have made reference to it, But i cannot get the value of string readValue.

This is my DLL...
Expand|Select|Wrap|Line Numbers
  1. Public Class Class1
  2.     Public Sub RegCheck()
  3.         Dim readValue As String
  4.          readValue = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\MySoft", "SomeKey", Nothing)
  5.     End Sub
  6.  
  7. End Class
I can call RegCheck() but i cannot get readValue


Expand|Select|Wrap|Line Numbers
  1. Imports Trial
  2.         Dim ck As New Trial.Class1
  3.         ck.RegCheck()
Is there something i need to declare ?

If anyone can enlighten me on how to get this value i would be extremely
greatfull as i have searched for days.


Thankyou,
Gobble.
Aug 16 '09 #1
6 2725
tlhintoq
3,525 Expert 2GB
I can point out this much...
In the sub in your DLL... Where do you return anything?
You declare a variable "readValue".
You set it equal to the registry key.
Then... ? Nothing. It is never returned out sent out
I am probably wrong, but I think you have to create a method that has an 'out' parameter to send the value back.
Aug 16 '09 #2
gobblegob
133 100+
Thanks for the reply, So your saying i need to somehow return the value?
Any idea how to do this?? because i can not find any information about this.
This is the first time i have worked with creating a DLL.

Gobble.
Aug 17 '09 #3
tlhintoq
3,525 Expert 2GB
I have never built a DLL either. I'm just applying the same logic that a method must return a value in order for the calling function to get something out of it.

Expand|Select|Wrap|Line Numbers
  1. string Example(string TestMe)
  2. {
  3.    return TestMe + ". That's what I mean.";
  4. }
  5.  
Another way to get a return is using the out keyword.
MSDN for the out keyword.
Aug 17 '09 #4
gobblegob
133 100+
Wicked mate i got it working. In the DLL it cant be a "Sub" it has to be a "Function". This is the Code if anyone else is looking how to do it..

This is in the DLL...
Public Function ReturnString()
Dim MyString As String
MyString = "Yep it Worked!"
Return MyString
End Function
This is how i Called it...

Imports MyDLL.Class1

Dim GetMyString As New MyDLL.Class1
TextBox1.Text = GetMyString.ReturnString 'ReturnString is the Function
Sharing is Caring
Gobble.

P.S Thanks tlhintoq
Aug 17 '09 #5
gobblegob
133 100+
Now i have to try and pass a string to the DLL any idea's?
Somehow i have to make a function that waits for a string because
I have no idea how to create a string without having a value in the DLL.
Any Idea's ?

why is it so hard to find any info about vb.net and simple DLL handling?
Gobble.
Aug 17 '09 #6
tlhintoq
3,525 Expert 2GB
Somehow i have to make a function that waits [...]
Huh? What do you mean "waits"? Why would it be waiting? It doesn't run until you call it. So you pass the string as a parameter when you call it.

why is it so hard to find any info about vb.net and simple DLL handling?
have you tried the book store in the programming section? Don't look just at the VB section. Look at the .NET books. since it is the same whether you are looking at VB or C#.
Aug 17 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: fiona | last post by:
Reading, Berkshire, UK 05 June 2007 - Crainiate Software make details available of the release of Objecto Framework 2.0, an upgrade to their enterprise business component framework, designed to...
2
by: =?Utf-8?B?SmFzb24gQS4gSmVuc2Vu?= | last post by:
I have a MSDN Subscription expiring this month but really need Visual Studio 2008 when it comes out. I called customer service to find out but they don't know. They seemed to think it was a...
58
by: Jon Skeet [C# MVP] | last post by:
Just in case people had missed it, Visual Studio 2008 is now available for download for MSDN subscribers, and the Express editions are also out: http://www.microsoft.com/express/download/ --...
9
by: =?Utf-8?B?RmxhdmVsbGUgQmFsbGVt?= | last post by:
Apparently the Java Conversion tool that used to be in Visual Studio 2005 is no longer supported in Visual Studio 2008. Anyone have any suggestions on how to convert a Java program to C# in Visual...
2
by: Nikolay Belyh | last post by:
1. Why does Visual Studio 2008 started ignoring //{NO_DEPENDENCIES} in resource.h? If I edit file "resource.h" _manually_, it rebuilds the whole solution. It worked just fine with Visual Studio...
4
by: lichaoir | last post by:
Can I develop asp.net 1.1 application in visual studio 2008? I've tried to find .net framework 1.1 in the project's properties window, but I can't find it! Please help! Thanks for your...
6
by: Miro | last post by:
I can run an exe ( and its install ) i have created on my machine. The exe has a button that populates a dataset and then shoots it to a crystal report. But... Installing the setup.exe on my...
4
by: Miro | last post by:
<i have also added this reply to the other newsgroup - now that I have realizd ( and assuming ) it is not a localized error directly to vb.> I have found this link on the website:...
0
by: _Who | last post by:
I'm trying to free up some space on my system disk. In Add or Remove Programs I see: Microsoft Windows SDK for Visual Studio 2008 .NET Framework Tools Microsoft Windows SDK for Visual Studio...
1
by: Puja Patel | last post by:
hi all, am not sure if this is the right place for this post. I created a website on .net framework 2.0 using visual studio 2005 and web service software factory. I created all my business...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.