|
How to close all open forms without current and startup forms?
|
|
|
|
|
Get the list of open forms by Application.OpenForms collection. Then, identify the current form and the start up one from the list. Close the rest of them. You can identify current one by matching the name or something and same goes for the start up form.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Hi,
In my application - I need to search for installed SQL Server instances on the wotkstation or network; so I can create the appropriate connection string and also for allowing the user to install sql server express if no sql server is installed.
Is there any way?
Thanks,
Ekjon
|
|
|
|
|
Check out SqlDataSourceEnumerator class. That will help you getting the list of SQL server instances on the network.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
u can use sqldatasourceenumerator to get the available sql instances
like
Dim dt As New DataTable
dt= Sql.SqlDataSourceEnumerator.Instance.GetDataSources
DataGridView1.DataSource = dt.AsDataView
|
|
|
|
|
Thanks d@nish and Dambod - it was very helpful.
|
|
|
|
|
Hi there,
I am currently trying to generate a report based on crystal report 10. In my report there are some parameters that should be displayed only once, some parameter for every record but some only a few times. Here is what i did, I put those parameters that will be
1. displayed once on the page headers
2. displayed for every record from the database in details section, and I used GROUPING for others.
Name____Col1_____Col2____Col3____Time
______________________________Dias_Horas_Minutos
SUBAREA_a
X____test____AAAA____AAAA1____1____2____3
Y____test____BBBB_____BBBB1____3____2____1
_____________________Subtotal____4____4____4
SUBAREA_b
X____test____AAAA____AAAA1____1____2____3
Y____test____BBBB____BBBB1____3____2____1
_____________________Subtotal____4____4____4
SUBAREA_c
X____test____AAAA____AAAA1____1____2____3
Y____test____BBBB____BBBB1_____3____2____1
_____________________Subtotal____4____4____4
_____________________TOTAL____12____12____12
My question is that possible to have a sub-grouping with grouping in Crystal report?
with regards,
modified on Wednesday, October 21, 2009 10:49 AM
|
|
|
|
|
Hello everyone
I am sure this is somting simple but i cant figuer it out
how you can you have a button click a button ???
say
when you click button 1 it will be like clicking button 2 button 3 at the same time ??
Thanks
Bob
|
|
|
|
|
Just call them;
Private Sub Button1_Click(sender As Object, e As EventArgs)
Button2_Click(Nothing, EventArgs.Empty)
Button3_Click(Nothing, EventArgs.Empty)
End Sub
I are Troll
|
|
|
|
|
Why not have a single handler for all the buttons? Then you can wisely put some conditions so that only a particular code is fired depending on the button clicked.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
I like Danish's method
Private Sub ClickAllButtons(sender As Object) Handles Button1.Click, _
Button2.Click, Button3.Click
Dim btn As Button = Nothing
If TypeOf sender Is Button Then
btn = DirectCast(sender, Button)
If btn.Name = "Button1" Then
callButton1Stuff()
callButton2Stuff()
callButton3Stuff()
ElseIf btn.Name = "Button2" Then
callButton2Stuff()
Else
callButton3Stuff()
End
Else
' Maybe a good idea to do something here.
Exit Sub
End
I don't speak Idiot - please talk slowly and clearly
'This space for rent'
Driven to the arms of Heineken by the wife
|
|
|
|
|
Right on guys thanks a lot
|
|
|
|
|
|
You should have posted it in General database[^] forum.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Hello,
I am programming in VB2005.
I have a Form1 and Class A:
a) In Form1, I have a Picturebox (Name=PictureBox1)
b) Class A inherits from PictureBox
I am trying the following but the Picturebox1 does not display anything:
Dim MyA As New A(PictureBox1.Width, PictureBox1.Height)
MyA.Location = New System.Drawing.Point(150, 150)
MyA.BackColor = Color.Red
PictureBox1 = MyA
Why doesn't it works?
I have an alternative to solve the problem but I would like to understood the problem above.
Alternative sdolution:
Dim MyA As New A(500, 350)
MyA.Location = New System.Drawing.Point(150, 150)
MyA.BackColor = Color.Red
controls.add(MyA)
Shay Noy
|
|
|
|
|
shaynoy wrote: In Form1, I have a Picturebox (Name=PictureBox1)
Why don't you use real variable names ?
shaynoy wrote:
Dim MyA As New A(PictureBox1.Width, PictureBox1.Height)
MyA.Location = New System.Drawing.Point(150, 150)
MyA.BackColor = Color.Red
PictureBox1 = MyA
This is a bit dumb. What you need to do, is either change your picturebox to be a ClassA, or you need to just create a picturebox and add it to the Controls collection of the form.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
This is a bit dumb. What you need to do, is either change your picturebox to be a ClassA,
My ClassA inherits from PictureBox object.
Now my form1 is creating a new instance of class A and this new instance will "return" a PictureBox that I would like to display on my form1. So I though to do the following form1.PictureBox1=NewInstanceOfClassA to display the result of new instance of ClassA to my form1.
...or you need to just create a picturebox and add it to the Controls collection of the form.
WHay to add it if already exists in my form1, I only want to overwrite it with my new instance of class A
Thank you
Shay Noy
|
|
|
|
|
shaynoy wrote: I have an alternative to solve the problem but I would like to understood the problem above.
Start by highlighting the differences between the first and the second code. What does controls.Add do?
I are Troll
|
|
|
|
|
In the first code PictureBox alrady exists so I do not have to add it.
In the second code PictureBox doesn't exist so I am adding it at run-time.
So what now?
Shay Noy
|
|
|
|
|
shaynoy wrote: In the first code PictureBox alrady exists so I do not have to add it.
PictureBox1 = MyA This would not 'replace' the PictureBox1 in memory with an MyA, and I don't know whether the property is smart enough to add the control to the controls-collection on it's own.
I are Troll
|
|
|
|
|
Thank you, so you suggest to use controls.add, don't you
Shay Noy
|
|
|
|
|
That's not what I'm suggesting; you asked merely why the first version didn't work as you expected it to.
I guess that you want to replace that pictureBox1 with a ClassA . Delete the PictureBox from the Form and drop a ClassA on it
I are Troll
|
|
|
|
|
What do you mean when you say drop?
Shay Noy
|
|
|
|
|
I meant dragging a ClassA-item from your Toolbox to the Form; just like you add any other control to the form
I are Troll
|
|
|
|
|
Thank you for the tip
Shay Noy
|
|
|
|