|
You probably shouldn't try to stop the user from deleting the row, but simply fake it, by checking that "no one else has the item", when the user deletes the row and then call YourDataSet.RejectChanges() , if someone does. In your code it will happen so fast that to the user it looks like he didn't delete the row.
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
How to make a button default-button on a dialogbox????
(Jameel)
|
|
|
|
|
Set the DialogResult property to OK and set the property of the form ( I think it's OKButton or AcceptButton ) to be that button. One causes the dialog result to be set when the button is clicked, the other causes the button to be clicked when you press enter.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
jamilkhan007 wrote: for each button as myButton in myKeyboard.controls
if button.name.equals(key.tostring())
button.pushdown
'it can be button.pushup in case of keyup event
exit for
Yeah, that's about the slowest way to do it. A better method would be to add each button to a hashtable, or some other key/value pair collection and use the Key you get as the key to get at the button (value) in the collection. No for/next loop required.
|
|
|
|
|
Isnt it a collection
"dim button as myButton= mykeyboard.controls(key.tostring)"
actually "myKeyboard" is a user control and is made of user control "myButton"... cant i directly point a button with in the keyboard????
plzz explain what collection i can use and how. i m
(Jameel)
|
|
|
|
|
I already did!! A HashTable!
Dim buttonsCollection As New HashTable()
buttonsCollection.Add(Keys.A, MyAKeyButton)
When you want to get at that button when the suer presses the A key:
Dim b As Button = buttonsCollection(Keys.A)
or something like that. It's written off the top of my head, so it could be a little wrong...
|
|
|
|
|
hi all,
i want to determine whether or not the selected item of checklistbox is checked or unchecked. I know this is very simple question but i did not found method for this task.
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
if me.checkedlistbox1.checkedindicies.contains(me.checkedlistbox1.selectedindex) then<br />
'do stuff<br />
end if
|
|
|
|
|
Thanks Anzac,
its work
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
I have created 2 radio buttons on my form but using databinding how i can hendle them?????
Base table name = "Employeer"
Column to be binded = "Gender"
HELP????
|
|
|
|
|
Use a radio button list, then you can set it's datasource to bind to a list from your database.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i have draged one by one radio button onto form.
is list-of-radiobuttons something else than this ????
|
|
|
|
|
as i am trying
i have created 2 radio buttons onto form separetly.
i am trying to set databinding on each radio button.
this is not working
|
|
|
|
|
I am using VB.NET 2003, MYSQL database and Crystal Reports. I am able to generate 1 set of reports using the following code:
Imports MySql.Data.MySqlClient
Imports SeungNiMartialArtsDB.modFunctions
Public Class frmRptProgramAttendance
Inherits System.Windows.Forms.Form
Private m_Conn As String
Private m_Program As String
Private m_ReportType As String
Public WriteOnly Property ConnectionString() As String
Set(ByVal Value As String)
m_Conn = Value
End Set
End Property
Public WriteOnly Property Program() As String
Set(ByVal Value As String)
m_Program = Value
End Set
End Property
Public WriteOnly Property ReportType() As String
Set(ByVal Value As String)
m_ReportType = Value
End Set
End Property
Private Sub cryRptView_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cryRptView.Load
Dim conn As New MySqlConnection
Dim myCommand As New MySqlCommand
Dim myAdapter As New MySqlDataAdapter
Dim sql As String
conn.ConnectionString = m_Conn
myCommand.Connection = conn
Select Case m_ReportType
Case "Roster"
sql = "select * from tblviewattendance WHERE program_name='" & m_Program & "' ORDER BY lname;"
Case "Attendance"
sql = "select * from tblviewattendance WHERE program_name='" & m_Program & "' AND last_class_attend=" & DateToLong(Now().ToLongDateString) & " ORDER BY lname;"
End Select
myCommand = conn.CreateCommand
myCommand.CommandText = sql
myAdapter = New MySqlDataAdapter
myAdapter.SelectCommand = myCommand
Dim progDS As DSProgram_Attendance = New DSProgram_Attendance
progDS.Clear()
myAdapter.Fill(progDS, "tblviewattendence")
Dim myReport As New rptProgramAttendence
myReport.SetDataSource(progDS)
cryRptView.ReportSource = myReport
conn.Close()
conn.Dispose()
End Sub
However, if I use the same set of code, but change the Datasets, and the SQL statements, the report does not generate. It leaves me with the following error:
"An unhandled exception of type 'System.NullreferenceException' occured in mysql.data.dll.
Additional information: Object reference not set to an instance of an object.
Below is the code that is generating the error: Please help!!!!!
Private Sub myViewer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles myViewer.Load
Dim conn As New MySqlConnection
Dim myCommand As New MySqlCommand
Dim myAdapter As New MySqlDataAdapter
Dim sql As String
conn.ConnectionString = m_Conn
myCommand.Connection = conn
sql = "SELECT fname, lname, birthdate FROM tblmembers;"
myCommand = conn.CreateCommand
myCommand.CommandText = sql
myAdapter = New MySqlDataAdapter
myAdapter.SelectCommand = myCommand
Dim birthDS As DSbirthdays = New DSbirthdays
birthDS.Clear()
myAdapter.Fill(birthDS, "tblviewattendence")
Dim myReport As New rptProgramAttendence
myReport.SetDataSource(birthDS)
myViewer.ReportSource = myReport
conn.Close()
conn.Dispose()
End Sub
|
|
|
|
|
I have a series of forms which have textboxes that require data to be entered over the page.
1/ How do I make it so that the cursor jumps to the next textbox (in the order I program) when the "enter" button is hit, regardless of whether or not any data has been entered?
2/ Can I set a key to reverse up in the same manner? eg. the left arrow key.
Sorry if this is a simple one, but I have been searching and not finding much helpful info.
Thanks F
|
|
|
|
|
Handle the KeyPress event of ALL the textboxs on your form. in that handler, look for the ENTER key being pressed and call the GetNextControl method of the control that fired the KeyPress event. That'll return the next control in the Tab Order. All you need to do then is call the Focus method of the returned control.
|
|
|
|
|
Many Thanks Dave for your help.
|
|
|
|
|
Hi, I have a problem when get the sum of value from Ms access. I have a table with column name LGVal (currency). This table cotain many record and I want to calculate the total of LGVal. The below is the code that I wrote:
Private Sub MonGrantItem()
' Clear the previous item.
lvwGrant.Items.Clear()
' Declare the new command to get grant from the database.
Dim cmdGetGrant As New OleDbCommand
With cmdGetGrant
.Connection = cnnDonorDb
.CommandType = CommandType.Text
.CommandText = "SELECT tblProgBudgetDetail.LGName, tblProgBudgetDetail.LGVal FROM tblProgBudgetDetail WHERE tblProgBudgetDetail.ProgBudIDDetail =" & CInt(strSubProgID) & " AND tblProgBudgetDetail.SourceType = False ORDER BY tblProgBudgetDetail.LGName" ' Source type = false mean Loan.
End With
' Open the connection.
Try
cmdGetGrant.Connection.Open()
Catch exFileNotFound As System.Data.OleDb.OleDbException
MessageBox.Show("The system has a problem to connect to your database system." & ControlChars.CrLf & "Please verify that your database is located in the following path: 'C:\DICDonorDb\DICDornorDb.mdb'", "Database file not found", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End Try
Dim drdGetGrant As OleDbDataReader = cmdGetGrant.ExecuteReader
If Not drdGetGrant Is Nothing Then
Dim lstGrant As ListViewItem
While drdGetGrant.Read
lstGrant = New ListViewItem(drdGetGrant(0).ToString)
lstGrant.SubItems.Add(drdGetGrant(1).ToString)
lvwGrant.Items.Add(lstGrant)
End While
End If
' Close the connection.
cmdGetGrant.Connection.Close()
' Declare the new command to get grant from the database.
Dim cmdTotalGrant As New OleDbCommand
With cmdTotalGrant
.Connection = cnnDonorDb
.CommandType = CommandType.Text
.CommandText = "SELECT SUM(tblProgBudgetDetail.LGVal) FROM tblProgBudgetDetail WHERE tblProgBudgetDetail.ProgBudIDDetail =" & CInt(strSubProgID) & " AND tblProgBudgetDetail.SourceType = False" ' Source type = false mean Loan.
End With
' Open the connection.
Try
cmdTotalGrant.Connection.Open()
Catch exFileNotFound As System.Data.OleDb.OleDbException
MessageBox.Show("The system has a problem to connect to your database system." & ControlChars.CrLf & "Please verify that your database is located in the following path: 'C:\DICDonorDb\DICDornorDb.mdb'", "Database file not found", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End Try
Dim drdTotalGrant As OleDbDataReader = cmdTotalGrant.ExecuteReader
' **************************************************************
'
' CONTAIN ERROR IN THIS POINT.
'
' **************************************************************
Try
lblTotalGrant.Text = "Total Grant: $ " & drdTotalGrant(0).ToString
Catch exNoRow As System.InvalidOperationException
lblTotalGrant.Text = "Total Grant: $ 0.00"
Finally
' Close the connection.
cmdTotalGrant.Connection.Close()
End Try
' Enable or disable update and delete button for grant.
If lvwGrant.Items.Count > 0 Then
btnUpdateGrant.Enabled = True
btnDelGrant.Enabled = True
Else
btnUpdateGrant.Enabled = False
btnDelGrant.Enabled = False
End If
End Sub
The bold line is the line that has an error. The bold and italic line is the line that I suspect to cause an error. Please help me to solve the problem. Thank in advance.
|
|
|
|
|
Please tell me the errror you are getting.
Ahamed Azeem
software Programmer
|
|
|
|
|
Now I could solve it. I forget to add the code [DataReader].Read in my code editor. Thank you for your help
|
|
|
|
|
Can any one let me know how to sort the values returned by a object data source using IComparer based on last name , first name and followed by date of birth? Step by step procedure is highly appreciated. You can send the code to soori007@yahoo.com
|
|
|
|
|
smutukundu wrote: You can send the code to
Not a chance! If you want help, then the whole community must benefit. We are not here just for you. Other people may have a similar problem.
|
|
|
|
|
That's OK. i can understand. Thanks for ur reply. But can u post the solution on the blog. It will be so helpful. Thank u once again.
|
|
|
|
|
I created a context menu strip that opens up when you click on an icon in the taskbar, but it will not close when i click on the desktop or on another application. I tried a couple of things and i noticed that it probably has something to do with the focus, but i cant figure out how to do it.
Any help is appreciated
|
|
|
|