|
I believe you open the form in Design view and in the tool box select the
"more controls" and/or the Calendar 10.0 (in my case) and drop it on your form.
hope that helps
|
|
|
|
|
I am currently wiring an application which needs to use the wake on lan function. I have searched the web for code to do this for several days. There is plenty out there in C, Java and old VB but I can not find any in VB.net. After spending a day trying to convert various examples without success I am a little stuck.
Has anyone out the got any code I could make use of.
Thanks in advance.
|
|
|
|
|
|
Thanks,
Just got back home from a trip will give it a try over the weekend.
Cheers
Geoff
|
|
|
|
|
Thanks for the code it works. I am suffering from one problem, if I wait say 1 hour from shut down the Wake on lan does not work. This problem does not effect a wol utility I am using.
Any Ideas
Thanks Geoff
|
|
|
|
|
Once i connected to sqlserver and executed the query then I closed the connection by either close() or Dispose() method and next time when I again open the connection and execute the query, the old connection is still there,
I can see it on the sqlserver, where the CPU usage as increased,
it never comes down, for the same the SPID getting increased, for each of my execution.
If I left ideal for sometime, the SPID is cleared,
my problem is, when I am in a continuous usage it is not getting cleared or decreased, even though each of my connection is a different instances,
(new sqlconnection)
does any body has face this issue,
Need some help on this
Regards
|
|
|
|
|
Try this method and tell me if you get the same result, we are using sql server 7 and visual studio professional we dont have any problems with connections or queries. this will also work for multiple connections just make sure you close the previous...
so lets first test the code...
copy and paste into a windows form dont forget to add
......Imports System.Data.SqlClient
at the very top of the code
Dim Dtr As SqlDataReader = Nothing
Dim Conn As New SqlConnection
Private Function SqlRetrieve(ByVal SqlString As String) As Object
Dim Index As Integer
Conn.ConnectionString = ("Server=192.168.42.210; database=shprod; " & _
"user id=sql_cfd; password=sql;max pool size=500")
'use to catch any exceptions
Try
'instantiate an sqlcommand
Dim cmdSelect As SqlCommand = Nothing
'open a conncetion to server
Conn.Open()
'run sql query
cmdSelect = New SqlCommand(SqlString, Conn)
'start a sqldatareader
Dtr = cmdSelect.ExecuteReader()
'return sql data
'reset exception flag
SqlRetrieve = Dtr
'catch an sql exception
Catch e As SqlException
'close server connection
Conn.Close()
End Try
End Function
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim MyList As New ArrayList
SqlRetrieve("SELECT timestamp FROM dbo.BEADMOUNT")
While Dtr.Read()
ComboBox1.Items.Add(Dtr(0).ToString())
End While
Dtr.Close()
Conn.Close()
End Sub
good luck!
|
|
|
|
|
hi
Thanks for response,
I tried this, but still the connection is opened, if I keep on accessing the query.....
Amju
|
|
|
|
|
add this in the last of procedure
gc.waitforpendingFinalizer() '' check if any spelling mistake
gc.collect()
I hope this will help
|
|
|
|
|
Hi
Yes i have added in code already, and
I think it wouldn't be any spelling error, since I usually get it through intellisence,I mean (gc.) will automatically display the exposed method/properties from where I select the appropriate option.
thanks for reply
Amju
|
|
|
|
|
ya GC. will automatically show this but does not show when you are writing in explorer textbox...
|
|
|
|
|
cool....
Amju
|
|
|
|
|
how to place controls on a form at run time
|
|
|
|
|
You can place controls at runtime using the following code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim MyControl As New MyButton
MyControl.CreateObject(Me)
End Sub
End Class
Public Class MyButton
Inherits Button
Public Sub CreateObject(ByVal Form As Object)
With Me
'just use the dot operator to add any new properties to the control
.Location = New Point(100, 100)
.Size = New Size(100, 100)
.BackColor = System.Drawing.Color.White
.ForeColor = System.Drawing.Color.Black
.Text = "Click Me!"
Form.Controls.Add(Me)
End With
End Sub
Private Sub MyButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Click
'the new control also has events
MsgBox("This Demonstrates how to add a control at runtime", MsgBoxStyle.Information)
End Sub
This should help!
Lets rock and Roll at Guildford Festival 2005 Oh Yeah!
|
|
|
|
|
this code is not working. i need the code for visual basic6.
|
|
|
|
|
I have a data table of which, one column has been made unique.
Datatable.Columns("ColumnName").Unique = True
This table has been assigned to a Data grid. While running the application when unique constraint is violated it displays an exception massage. Is it possible to catch this exception massage and customize according to my wish?
|
|
|
|
|
Catch ex
Throw New System.Exception("your customize message.")
Amju
|
|
|
|
|
But where to catch this exception, since I am not able to trace where does this exception is generated. I tried most of the events related to Data Grid and Data Set. No where I could find the event which cause this exception.
Krishnaraj
|
|
|
|
|
hello to all
i am beginer in use of stored procedures, and i want to use stored procedure in vb. if use of stored procedures equal use table, how i can sent parameter to stored procedure from vb.
thanks
|
|
|
|
|
try this:
Dim oCmd As IDbCommand = New SqlCommand
Dim oDataAdapter As IDbDataAdapter = New SqlDataAdapter
Dim oDataSet As DataSet = New DataSet
oCmd.CommandText = [sp exec statement w/ parameters]
oCmd.Connection = [sql connection string]
oCmd.CommandTimeout = 600
oDataAdapter.SelectCommand = oCmd
oDataAdapter.Fill(oDataSet)
Return oDataSet
it's just a sample code, but this is how i run my sp's on my codes... hope this helps
|
|
|
|
|
sir i created one vb application in that i am genarating excel reports. first time am clicking report command button then it running executing correctly if i am click once again the report command button it is not running showing error.
iam using this commnad for add sheetsin my codeing "Sheets.Add before:=Worksheets(Worksheets.Count)"
the error for second time click is
"worksheets.count=
|
|
|
|
|
This is the source code
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.Data.SqlClient
Imports System.Data
Private str_connection As String = "workstation id=""MAX-IT10Q0"";packet size=4096;integrated security=SSPI;initia" & _
"l catalog=Addressbook;persist security info=False"
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cnsql As SqlConnection
Dim load_dataset As New DataSet
Dim rpt As ReportDocument
Dim str_query As String
rpt = New ReportDocument
rpt.Load("..\CrystalReport2.rpt")
cnsql = New SqlConnection(str_connection)
cnsql.Open()
str_query = "select name,Address from tb_abook"
Dim load_adapter As New SqlDataAdapter(str_query, cnsql)
load_adapter.Fill(load_dataset, "tb_abook")
rpt.SetDataSource(load_dataset)
CrystalReportViewer1.ReportSource = rpt
End Sub
Continue...
|
|
|
|
|
and what happens ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Which Version of Crystal reports are you using?
try rpt.Refresh after rpt.SetDatSource(load_dataset)
Amju
|
|
|
|
|
Hi! Does anybody know how to get values for listbox if i am using multiple selection in VB.NET?
|
|
|
|