|
I have a class, class A. Within that class are defined multiple properties. (Gets and Sets). In the same project, I have a second class file, Class B. Class A's properties are public, but I am unable to access them from Class B, and when I try to pass Class A into Class B, it doesnt allow it, saying "Class A is a type and cannot be used as an expression". Not sure what I need to do to make Class A Accessible within Class B. Can anyone point me to where I need to go?
Thanks
|
|
|
|
|
What you need to do is post code. Best guess - you are trying to access them as ClassA.SomeProperty when they are not static. YOu need a class instance ( which holds the value for thqat instance only ) or to make them static ( which I think is Shared in VB )
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Here is what I have, in Class A:
<microsoft.visualbasic.comclass()>Public Class ClassA
Private Shared propName As String
Public Shared Property strPropName() As String
Get
Return propName
End Get
Set(ByVal value As String)
propName = value
End Set
End Property
End Class
That will allow me to access it as a property directly within another class. (Thanks) However, these properties are set from a VB6 application, which then calls different methods within Class B. I can access the properties in Class B now, but they are not visible in the VB6 app anymore. I have the project setup for Com Interop, and can see everything else, just not the properties I set this way. Am I stuck with one or the other? Or is there a way to get both? I found that if I change the Public Shared Property to just Public Property, I can see it in the vb6 app, but not in the other classes within the project.
|
|
|
|
|
rahvyn6 wrote: Or is there a way to get both? I found that if I change the Public Shared Property to just Public Property, I can see it in the vb6 app, but not in the other classes within the project.
Sounds like you can have one or the other.
There's no way to do it without having something shared at some point.
One possible hack is to have a non shared property which, when called, sets or gets the shared one. So, you have a non shared property, which turns out to really be shared.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
That would be a major pain, I have around 150 properties.
|
|
|
|
|
Sure - I'm afraid I have no other suggestions.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
|
I want to know that how i get hdd serial no by codding in vb.net PLZ help me.
Thak You
Vikash Yadav
|
|
|
|
|
You need to use WMI to do this, and you also need admin access when your code is running.
There's plenty of examples on the web.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi I want how design salary slip data base in ms access and also please give me example project if possible in VB.Net
|
|
|
|
|
What is is that you have problems with; designing a database in Access, or the specific design of a "salary slip" database?
---
b { font-weight: normal; }
|
|
|
|
|
My Question is how we design the database for example just take the employee details and calculate his salary based on no of attended days . if particular employee get hike that also i have to calculate and then i want to show in view screen and then i display in crystal report.if i want to see all the employee details that also i will able to see .Back end is Ms Access and front end is VB.Net please Help me .
|
|
|
|
|
Is this your homework, or are you being paid to write this ? Either way ( but all the more if it's homework ), you need to take the first steps yourself, and ask *specific* questions when you get stuck on *specific* things. If you have no idea how to start, then either talk to your teacher, or let your boss know that you're being asked to do something that is out of your depth.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I am a newbie of vb.net.Now i wanna draw some electronic circuit in vb.net.Anyway, i have found Image Editor tool which seems to be usable with this kinda drawing.Unfortunately, i cannot click it, They cannot be clicked to use.Could you please help me how to use it??
Thanks in advance.
|
|
|
|
|
I have no idea what tool you're talking about. To do what you want, you need to handle the paint event of your control/form, and draw your circuit. You can use the mouse events to handle drawing items and if you want to click on parts and select/interact with them, you need to keep each item in a list and handle selection from there.
vuthcam wrote: I am a newbie of vb.net
This probably means you didn't understand a thing I just said. That would be because an electronic drawing program is not a suitable choice for a first programming task. You probably need to write a few simpler programs to build the skill level necessary to approach this task. Ideally, you'd write some console programs first, although in my experience most people are too impatient to learn to code properly nowadays, especially in the .NET space, and doubly so in VB.NET. However, that's good advice, and you should consider taking it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I understand yours. Although i am a newbie it doesn't mean i understand nothing. Newbie of mine means than i don't have enough ability yet to code some big pro. But this i think it is something usual. We just draw the static pic of that circuit then to code it.
As i have said, i have found some kinda tools which is suitable to be used but i reall wonder that i cannot use it...ok i'll post something in my blog.I hope you can spend time for helping me ...thanks...it is very kind of you..
My Blog: www.vuth-it.blogspot.com
|
|
|
|
|
vuthcam wrote: Although i am a newbie it doesn't mean i understand nothing.
Fair enough - there are different ways to take the word 'newbie' and a lot of people are coding for the first time ever and trying to write complex code that is beyond them. I didn't mean to talk down to you, just to give good advice.
vuthcam wrote: As i have said, i have found some kinda tools which is suitable to be used but i reall wonder that i cannot use it
For this task you need to build the sort of framework I suggested, I would be surprised if you found something that did exactly what you wanted.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi all
this code :-
Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
help you If any press key on the form to get the char (e.KeyChar )
but if I make form hide and press any key press any key you cant get e.KeyChar...
my question if i make form hide or my application works on backgorund how can I get e.KeyChar ..
Thanks .
AMR
|
|
|
|
|
The form will not accept key events as it no longer has focus. A possible way to get around this to create a class/module that does specific processing when a key event is raised.
e.g. Create a module that does whatever it is you want done -
Option Strict On
Public Module basKeyEvents
'this class handles key events on every form
Public Sub DoWork()
'''Do work
End Sub
End Module
Then call that method from within the form when a key event is raised
Private Sub Form_KeyUp(....)Handles Me.KeyUp
If e.KeyCode = Keys.F12 Then
DoWork()
End If
End sub
Remember to set the forms KeyPreview property to True .
|
|
|
|
|
You could also try handling all of your apps key presses manually...If you go here:
http://www.codeproject.com/useritems/winSpriteLib.asp[^]
I have a keyboard manager that you could probably modify for this...
Pablo
Sometimes I think there's no reason to get out of bed . . . then I feel wet, and I realize there is.
|
|
|
|
|
I am using Process.Start to being another application which it does with no problem, but the new application is behind my current window. How can I get the new application to come to the front?
|
|
|
|
|
Instead of using Process.Start, try using the Shell command. Example:
<br />
Shell("C:\", AppWinStyle.MaximizedFocus, True)<br />
|
|
|
|
|
how to read data from excel file and save results to sql table
platform is vb.net for windows forms
|
|
|
|
|
Just create an oledb connection to excel sheet and read data either using data adapter or data reader and then fill the desired data to the sql using another sqlconnection. i think this my help
|
|
|
|
|
how to read data from excel file and save results to sql table
|
|
|
|