|
This code works in Visual Studio 2003. Form1 has a ListBox on it. Form2 has two command buttons named btn1frm2 and btn2frm2. Programatically create two command buttons on form1 and set them equal to the command buttons on form2. Now you can capture the events from the buttons on form2 in the event handlers for the buttons you programatically created on form1 as follows:
Private WithEvents b1f2 As Button<br />
Private WithEvents b2f2 As Button<br />
<br />
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
<br />
Dim form2 As New Form2<br />
<br />
b1f2 = form2.btn1frm2<br />
b2f2 = form2.btn2frm2<br />
AddHandler b1f2.Click, AddressOf b1f2_click<br />
AddHandler b2f2.Click, AddressOf b2f2_click<br />
<br />
form2.Show()<br />
<br />
End Sub<br />
<br />
Private Sub b1f2_click(ByVal sender As System.Object, ByVal e As System.EventArgs)<br />
ListBox1.Items.Add("1")<br />
End Sub<br />
<br />
Private Sub b2f2_click(ByVal sender As System.Object, ByVal e As System.EventArgs)<br />
ListBox1.Items.Add("2")<br />
End Sub<br />
|
|
|
|
|
Am using VB.NET 2005 with WebBrowser Control, when i run it then i typed the url and then it display correctly, when the javascript is alert the title is Microsoft Internet Explorer, how can i chnage it?
................
|
|
|
|
|
VB.net / sql. Consider I have a table in sql with fields A to F each storing an integer value. I need to find the maximum value from the fields. Can anyone help me with this. Can this be done through a sql query? if yes, then how and if not then how to find the maximum value through program. plz help fast...
With Best Regards,
Mayur
|
|
|
|
|
hi
if you want to select the max value in the column A :
SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand("select max(A)from TableName", SqlConnection1)
SqlConnection1.Open()
Dim max As Integer = CType(SqlSelectCommand1.ExecuteScalar(), Integer)
SqlConnection1.Close()
Tamimi - Code
|
|
|
|
|
thnx for your reply. However, I do not want to find the max value from a particular field. I need to find the maximum of the value from the fields A to F. say A has a value 1, B-2, C-3, D-4, E-5, F-3, then I need to find the value 5 using a query or a piece of code. Remember A, B, C, D, E & F are field names and not records.
With Best Regards,
Mayur
|
|
|
|
|
Well then execute the query 6 times or just make one select to get the maximum of all fields together and then use Math.Max to determine the biggest ones among these.
|
|
|
|
|
Thnx Robert. Maybe I will try and explain it once again.
Consider a table having A - Z fields storing integer values. Therefore each record in this table will have A - Z fields. I need to find the maximum value for each record from the fields A - Z.
Can you plz help me with this.
With Best Regards,
Mayur
|
|
|
|
|
There is no simple way of doing that, as the database is badly designed.
For the fields A to C, it would be
select case when A > B then (case when A > C then A else C end) else (case when B > C then B else C end) end from ...
Imagine what that would look like for A to Z... The query would most likely be too complex to even run...
The values should be stored in separate records (in a separate table) if you want to be able to aggregate them efficiently.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks Guffa. I understand what you mean to say. Can you suggest a way this can be done using vb.net. As in reading a record and then finding the maximum value through code...
With Best Regards,
Mayur
|
|
|
|
|
You have badly designed the database, and there is no easy way to aggregate this data.
Maybe you could explain what you are trying to achieve, and somebody could make some suggestions on how to go about it better.
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
Hi, how can i get the motherboard's unique ID using VB? I have seen recently an article on Code Project describing how to do this using web and .net but i need to do the same in vb.
Rod
|
|
|
|
|
Hello everybody. Below codes didn't run but they could run on visual studio 6.0.
I am using .net 2003. Is there any idea? thanks.
Dim xapp As Excel.Application
Dim wb As Excel.Workbook
Dim ws As Excel.Worksheet
xapp.Visible = True
xapp = new Excel.Application
wb = xapp.Workbooks.Open("d:\sample.xls")
ws = wb.ActiveSheet
...
|
|
|
|
|
try this :
Dim var_AppClass As New ApplicationClass
Dim var_wookbook As WorkbookClass
Dim path As String = "c:\Book1.xls"
var_wookbook = var_AppClass.Workbooks.Open(path, 1, True, 5, "", "", True, Excel.XlPlatform.xlWindows, "\t", True, False, 0, True, 1, 0)
Dim var_sheets = var_wookbook.Sheets
...
Tamimi - Code
|
|
|
|
|
I want to develop an application in VB.Net which monitors the access to PC. So when PC boots my Application must pop disabling all options like Task bar, right click, all special keyboard function (Like Ctrl+Alt+Del). Can anybody suggest how to achieve this in VB.Net
Regards,
Krishnaraj
|
|
|
|
|
Hi all,
i got this error
An unhandled exception of type 'System.NullReferenceException' occurred in esB_SSR.exe
Additional information: Object reference not set to an instance of an object.
anyone can help me out?
tnx...
-::maximus::-
|
|
|
|
|
You did not send any useful information about the code that casued the problem or what you are trying to do..So don't expect a lot.
|
|
|
|
|
|
Hi,
I am having some Buttons and Radio Buttons on my Form. I am using UP and DOWN arrow keys as Hot keys for some Buttons and I want to assign SHIFT + UP and SHIFT + DOWN keys as Hot keys for some other buttons. How can I do this? The Code for UP and DOWN arrow keys is given below:
Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean
Select Case keyData
Case Keys.Up, Keys.Down, Keys.Left, Keys.Right ' (Left/Right also navigate controls)
If keyData = Keys.Up Then
Button1.PerformClick()
ElseIf keyData = Keys.Down Then
Button2.PerformClick()
End If
Return True
Case Else
Return False
End Select
End Function
.Net Programmer, Software Engineer
|
|
|
|
|
hi
how r u all
i need help i must to do project and in tha form there is combobox and month calendar
and in said the combobx aname if i choice name it will show the information for that parson in data grid
and the month calendar whene i prass in the date it will be show tha information in data grid for this date
can u tell me how can i write the code for that in visual basic
thanx alot
|
|
|
|
|
Hi,
assumming you have a DataTable bound to your grid you will have to set the RowFilter of its DefaultView to a string representing your cirteria. A description on how the filter must look like can be found here[^]. You could also have a look at one of my articles[^] dealing with this or probably even just use the component.
|
|
|
|
|
hanx
i have the database i make but the thinx i need is how can i write
the code in saide the compobox to display tha information for the name that i choice for ex ur name in my database and in the form ther is compobox and i choice ur name and ur information will show in tha datagrid
|
|
|
|
|
I am using Visual Basic 2005 Express Edition and trying to create crystal report using backend access database. When I click Project --> add new item, i cannot find crystal report template to use.
How to add crystal report template to my available list of templates or is there any other way.
Cheers,
Roger
|
|
|
|
|
OK, before you read any further I do not want to rewrite a web server. What I want to do is have my application sat in the system tray and to have a port open to which other clients can connect. When they connect my little app sends it's interface in the form of html files to the client (lets say a web browser on a PDA). The question is: where is there any tutoials on a client/server architecture which transmits web pages?
|
|
|
|
|
|
Anyone know how to programatically create a cursor?
A simple method (Or code to place in a method) like: Function CursorFromBmp(ByVal CursorPicture As Image, ByVal HotSpot As Point) As Cursor would be nice. The cursor should look exactly like the image. The Transparancy Color should be Color.Transparant.
|
|
|
|