|
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
|
|
|
|
|
Install the .NET Framework 2.0 on it. You can get the redistributable installation from here[^] if you don't have it already.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thank-you. You are correct, and thank you for the link. One more question: the link shows three versions of the .NET framework, x86, x64, and IA64. How does one determine the correct version?
Rich Feldman
|
|
|
|
|
The x64 and I64 versions are for 64-bit versions of Windows. You'll more than likely want the x86 version.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I have a datagridview that gets its data from a bound datatable.
I want to make the column into a checkbox column
Something like this, I think, but this isn't quite it.
DataGridToUse.Columns("Active").DefaultCellStyle = Windows.Forms.DataGridViewCheckBoxColumn
thanks in advance
|
|
|
|
|
you can use the designer to change the type of column. in the designer click on the column and view its properties. you should see a property that will change from text to link to checkbox etc.
|
|
|
|
|
Oh sorry, I forgot to mention that this datagrid is being created during runtime.
|
|
|
|
|
You're probably looking for something along the lines of:
With DataGridView1
.Columns.Clear()
Dim newCol As New DataGridViewCheckBoxColumn
newCol.HeaderText = "Header"
newCol.DataPropertyName = "dbColumnName"
newCol.DataSource = dataSource
newCol.ValueMember = "dbColumnName"
newCol.DisplayMember = "dbColumnName"
newCol.Width = 160
.Columns.Add(newCol)
End With
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|