|
OK, you can do that with reflecton. You can reflect over your objects and get out variable names and values.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I run Win XP sp2 and want to monitor a server. I have searched the web left to right, but I cannot find out how I retrive information about the chassis temperature or what workgroup a server is in.
There are plenty of examples showing how to display the computer name for example Private Declare Function GetComputerName Lib "kernel32".
I though I could use WMI to find the temperature. Does anybody have a small code sample?
To find the workgroup I read something about netapi32. But it seems very complex. Surely there must be an easy way to check the name of the net workgroup a computer is in.
As you can understand, I am a VBA novice .
Help greatly appreciated.
|
|
|
|
|
How to dissallow the user to open an opened form
I mean dont allow to create many instance of the same form
(if form is open dont open it again
Regards
Ramy
|
|
|
|
|
Goto the "Project->Project Properties->Application" menu in VS, and then click the "Make single instance application" check box.
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
i checked it
but more then one instance are still running
note i am using the following
dim fr as new form1<br />
fr.show()
do u think is there a problem with the above code?
anything should be added to it
Regards
Ramy
|
|
|
|
|
try this, but i havent test it.
dim fr as form1
if fr is nothing then
fr = new form1
end if
fr.show()
|
|
|
|
|
Creating a single instance application just prevents an application from being run more then once. It doesn't prevent a form from being created multiple times. I believe the appropriate way to create a single instance form is the following.
Public Class Form2
Private Shared m_Singleton As Form2 'Current instance
'Declared private so a new instance can't be created directly
Private Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
'Gets the current instance of the form or passes back a new one
Shared ReadOnly Property Instance() As Form2
Get
If m_Singleton Is Nothing OrElse _
m_Singleton.IsDisposed OrElse _
m_Singleton.Disposing Then m_Singleton = New Form2
Return m_Singleton
End Get
End Property
End Class However, if this is your main form you may need to make a small tweak. The code that gets generated to load your form won't used the shared property Instance. If you get an error and can't figure it out let me know. All I did was double clicked the error and then changed the line it brought me to so that it used the Instance property.
|
|
|
|
|
thx for helping
I used your Code and
when i was calling the form with following code :
Dim frm As New frmCollectAlarms<br />
frm.Show()
I got the following error
Error 1 'AMS.frmCollectAlarms.Private Sub New()' is not accessible in this context because it is 'Private'
any hint
Regards
Ramy
|
|
|
|
|
Sorry, I should have mentioned how to use it also. The 'Sub New' was declared private so you can't create a new instance of the form. If you could create a new instance then you would be able to create multiple instances, which would defeat the purpose of a singleton form.
The proper way to access the form is through the shared property 'instance'. So to show the form you would just use
frmCollectAlarms.Instance.Show If you create a variable to point to the form you would use
dim frm as frmCollectAlarms = frmCollectAlarms.Instance However, that method isn't necessary and kind of goes around the idea of a singleton form. The reason is that you could technically have more then one frmCollectAlarms in memory, however, only one would be usefull while the others would be disposed.
One thing I learned is that the method I used isn't thread safe. I did a little research after I posted the code just to make sure I hadn't steered you wrong. If you plan on accessing the form from multiple threads then you should do a little research on creating a thread safe singleton form. However, if you don't plan on accessing it from multiple threads then I wouldn't worry about it. Although looking up singleton forms may be a good idea anyway just for future knowledge. Especially 'thread safe' singleton forms.
|
|
|
|
|
i m not using threads...
i guess its working pretty good
thx for ur help
Regards
Ramy
|
|
|
|
|
Hi all,
Im trying to close aform by pressinga button, but the form doesnt seem to close (rather it just sits in my task bar below)
i have form1 open and by pressing a button i'd like form2 to close and form3 to open so heres my code.
Form2.Close()
Dim popup As New Form3
popup.Show()
but this doesnt seem to work (the button for this code is on form1)
Thanks in Advance
Jaidev
|
|
|
|
|
It looks like you are using the form itself not an instance of the form.
i.e
Public Class Form1
Inherits System.Windows.Forms.Form
Dim f As Windows.Forms.Form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
f = New Form2
f.Show()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
f.Close()
End Sub
End Class
|
|
|
|
|
Hello guys
an error occured while i was choosing a picture within a picture box
the error is :
item with same key has already been adding
I cant add an image to my project,not even background image for a form
I always get the above error
Note : if i open an other Project and try to add a picture,everything goes fine
Regards
Ramy
|
|
|
|
|
That's a weird designer error. Have you tried adding the image in code instead ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Coding went good
PictureBox1.Image = Image.FromFile("IMAGE_00098.jpg")
but i m still getting the same error as before ,if I m trying to add a picture not by coding
I think i have done sght in Resources things....
do u think that might cause such error?
Regards
Ramy
|
|
|
|
|
I have no idea, sorry.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I will post this issue again...
i might get help from some1
thx
Regards
Ramy
|
|
|
|
|
I am writing a command line vb.net application using Visual Studio 2003 and .net Framework 1.1. I am not usually programming in .net so am not very familiar with the environment.
I would like to be able to install my .exe via a copy command, and not have to run the .net framework wizard to authorize it to run. My understanding is the only way I can do that (and please correct me if I am wrong) is to give the application a strong name and use caspol to -addfulltrust it.
Unfortunately, my application relies on a 3rd party dll which provides a COM interface to the work my app needs to do. That dll does not have a strong name, so my efforts to give my app a strong name won't succeed.
Is there a way to add a strong name to an existing dll that I cannot rebuild? Is there a way to give my app a strong name and get around the issue with the 3rd party dll not having one? Is there a better way to allow my app to install without trying to use caspol to set the security?
Thanks,
Barry
|
|
|
|
|
I have a dot net application that uses a 3rd party activeX control. And I don't have to run the .net wizard to enable it to run. I do use an msi to install it. The main thing I would be concerned about is making sure your com object is registered in the host system.
|
|
|
|
|
Load DEnvAparoAtt
With DEnvAparoAtt
If .rsDcmd_OneSubjAtt.State <> 0 Then .rsDcmd_OneSubjAtt.Close
End With
Rpt_SpecificSubjectAtt.Sections(2).Controls(2).Caption = cmb_fac.Text & " ( " & cmb_group.Text & " ) Part-" & cmb_part.Text & " Section ( " & cmb_sec.Text & " ) " & cmb_shift.Text & " " & cmb_Ses.Text & " Student Attendenace For " & Cmb_subject.Text
Rpt_SpecificSubjectAtt.Refresh
If Rpt_SpecificSubjectAtt.Visible = False Then Rpt_SpecificSubjectAtt.Show
i write this code and the data report not show refresh report?
|
|
|
|
|
Hi.
i need to work out how to accept and use the printrange settings of a printdlg accordingly. any ideas as to how i get my printpage handler to print based on for example FROM page and TO page etc.
Many thanks.
Robbo
|
|
|
|
|
I want to change the color of the scrollbar in listview to fit the form color.How can do it?
|
|
|
|
|
I have a VB.NET (2005) program that reads some data from an Access file, makes it available to the user on a DataGridView and does some calculations. My understanding is that if the .exe file and Access input file are moved to another machine that is running Windows XP, then the program should run without needing to do an installation like VB6 requires.
I have placed the .exe file and the Access input file into a folder and copied this file to two other machines. The first machine was a desktop, and everything ran fine. The second machine was a laptop and the error message "The application failed to initialize properly" was obtained when an attempt was made to execute the program. Both machines are running Windows XP, Professional v. 2002 with Service Pack 2, and both have Access 2003 installed. Any ideas on why the VB.NET executable did not run on the laptop?
Rich Feldman
|
|
|
|
|
RichFeldman wrote: Any ideas on why the VB.NET executable did not run on the laptop?
Probably because the laptop does not have the .NET Framework v2.0 installed.
|
|
|
|
|
Thank you. You are correct; the laptop did not have .Net Framework installed.
Rich Feldman
|
|
|
|