|
you have a couple of options
1. Open Forms collection
my.application.openforms collection[^]
but this assumes the form is already loaded!
2. or this code snippet
Public Function GetForm(ByVal Formname As String) As Form
Dim t As Type = Type.GetType(Formname)
If t Is Nothing Then
Dim Fullname As String = Application.ProductName & "." & Formname
t = Type.GetType(Fullname, True, True)
End If
Return CType(Activator.CreateInstance(t), Form)
End Function
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
I like open questions.
|
|
|
|
|
In VB 2010 the TextBox displays negative sign after the number. It displays -1234 as 1234-. I am coding a calculator and it has a +/- button.
code is :
if plusminus button is clicked
ReadOut.Text = Convet.ToString(Convert.ToDouble(ReadOut.Text) * (-1))
|
|
|
|
|
Use this
ReadOut.Text = (CDbl(ReadOut.Text) * -1).ToString
I don't speak Idiot - please talk slowly and clearly
'This space for rent'
Driven to the arms of Heineken by the wife
|
|
|
|
|
The codes below doesn't solve my Problem
ReadOut.Text = Convet.ToString(Convert.ToDouble(ReadOut.Text) * (-1))
ReadOut.Text = (CDbl(ReadOut.Text) * -1).ToString
|
|
|
|
|
Asked and answered two days ago[^]. Please don't bump your posts like that, and read all replies you get.
|
|
|
|
|
Hello !
Always i have used this code to query from entity framework
dim query=From t1 in context.mytable where conditions
select t
Now i need to declare query variable before using.this is my code
----------------------------------------------------
Dim query1 as ???????
Dim list1 as ???????
query1=From t1 in context.mytable where <conditions>
select t
list1=From t1 in query1.ToList where <conditions2>
select t1
---------------------------------------------------
What are the types that should i use on Dim .....?
thank you.
|
|
|
|
|
|
You have many ways to consume the results but, which is best depends on what you are after doing with the results.
I would look into
1.
dim Query as IEnumerable(of t)
Ienumerable(of t)[^]
2.
dim Query as List(of t)
List(of t)[^]
3.
dim Query
But this one you already know about
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
thank tou , but in my code i have :
Dim query1 as ???????
Dim list1 as ???????
query1=From t1 in context.mytable where conditions1
select t
list1=From t1 in query1.ToList where conditions2
select t1
which of your variants should i use for query1 and list1 ???
thank you !
|
|
|
|
|
without knowing what you are going to do with the results. I would start with using the list(of t) where t is your table name.
I.E
dim Query1 = (From t1 in context.mytable where conditions1 select t)
dim List1 as list(of mytable) = (from t1 in Query1 where conditions2 select t1).toList
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
dim Query1 = (From t1 in context.mytable where conditions1 select t)
dim List1 as list(of mytable) = (from t1 in Query1 where conditions2 select t1).toList
i need to declare Query1 variable and list1 variable before and after to use them
Dim query as ????????
and after to use : query1=From t1 in ......
so how i can declare Query1 ?
Thank you.
|
|
|
|
|
With Visual studio 2008 you can use anonymouse types. Further reading Anonymous types[^]
As your first query is consumed only by the second query I would stick with using an anonymous type. Personally I feel outside of LINQ statements they shouldn't be used.
If you feel the need to have a type declared you can choose either a IEnumerable(of t) or IQueryable(of t)
This article gives you hints when you should each type IQueryable vs IEnumerable[^]
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
i use visual studio 2010 /sql server 2008r2.
IEquerable(of t) ---- doesn't work ( give some errors on second query)
IEnumerable(of t) --- works fine when i declare both Query1 and list1 as Ienumerable(of t).
thank you.
|
|
|
|
|
I had no problem executing a similar query to the one I advised you.
I would suggest that you send the Actual query (including the actual types that you are returning) that you are trying to execute and the error message that you are getting and we should be able to solve your problem.
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Well, I'm making an autoupdater/autopatcher, and everything's going swimmingly, but I've recently reached an impasse, I've noticed, that if there's a need to overwrite a file, SharpZipLib would actually return false, and not unzip a single thing. Anybody got any info on why this is, or maybe some example code on how to use it?
modified 21-Nov-11 18:01pm.
|
|
|
|
|
Little bump, if that's OK.
|
|
|
|
|
I have 1 tabcontrol with 3 tab (tab1,tab2,tab3)
each tab have 1 datagridview (datagridview1,datagridview1,datagridview3)
I add 1 button and want to export data from datagridview in the tab that I focus on. (I don't want to add 3 button for each tab)
How can I do that.
Thank you.
|
|
|
|
|
Take the tabcontrol, get the active tab and search the controls collection for a DataGridView, that will then give you a reference to which DGV is currently displayed.
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Try
Dim currentDGV As DataGridView = getActiveDataGridView()
Debug.WriteLine("Active DGV name is: " + currentDGV.Name)
Catch ex As Exception
Debug.WriteLine(ex.Message)
End Try
End Sub
Function getActiveDataGridView() As DataGridView
For Each cont As Control In TabControl1.SelectedTab.Controls
If TypeOf cont Is DataGridView Then
Return cont
End If
Next
Return Nothing
End Function
|
|
|
|
|
It's working.
Thank you very much.
|
|
|
|
|
njtd wrote: It's working.
I should hope so!
|
|
|
|
|
I am not able to get the right value for radians to degree conversion by the following code. It gives wrong value plz help.
ReadOut.Text = System.Math.Sin(Val(ReadOut.Text)) * (180 / System.Math.PI)
|
|
|
|
|
To convert radians to degrees you use
double degrees = (180 / Math.PI) * radians;
So you should try
ReadOut.Text = Convert.ToDouble(ReadOut.Text) * (180/Math.PI);
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
Thanks anyways. I tried the methods but they don't work for me.
|
|
|
|
|
I tried the below code. for radian 0.989 to degree it is giving 56.2xxx
ReadOut.Text = System.Math.Sin(Convert.ToDouble(ReadOut.Text)) * (180 / System.Math.PI)
|
|
|
|