|
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
|
|
|
|
|
On a remoting project I use a Class Library that implements an Interface and Several Classes,
My client applications (windows services) use the Interface for remoting one or some of the classes from the Class Library as parameters sent to a Server Application (windows application).
Everything works fine as long as I don´t SIGN the assemblies, but the moment I SIGN the assemblies
all subs or functions that use the classes from the Class Library as parameters fail to be
'Transmitted' to the Server Application, however the same subs keep working if the parameter is a string, a hashtable or any other system type.
Note I said 'Transmitted' because I don´t know a better term to express the problem
I must say that No Exception is ever thrown, all assembiels reference the same Class Library
with same Keys, versions and Tokens
1.- Is a permission attribute missing?, which one at code level?
2.- I don't want to use
<Assembly: Security.AllowPartiallyTrustedCallers()>
as all code inside the assembly would be exposed to PartiallyTrusted Callers
3.- Must I use the GAC (MSDN says it is not necessary)
Example (All unnecessary code stripped)
<pre><Serializable()>Public Class ClsStatistics
Private _hits as Long = 0
Public Property Hits() As Long
Get
Return _hits
End Get
Set(ByVal value As Long)
_hits = value
End Set
End Property
End Class</pre>
Does anybody have the same problem or answer
Ramon Barreda
ramonb0@msn.com
|
|
|
|
|
I am having significant problems setting the ip address/subnet/default gateway from a vb.net windows application. The trouble I am having is that it appears there is no service key in the registry to point me to the tcpip key in the currentControlSet. The key below
SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\1
appears in some of the articles I have found, but that does not seem to point to the correct service for active network cards. There is no ..\CurrentVersion\networkCards\ folder in:
SOFTWARE\Microsoft\Windows\CurrentVersion\NetworkCards\1 as I would suspect.
Any help is appreciated.
dave
dave
|
|
|
|
|
You have two problems. First, you're looking in the wrong place to set the IP. Second, you're trying to poke the IP into the Registry. Don't.
Use the appropriate tool. WMI and the Win32_NetworkAdapterConfiguration[^] class, specifically, the EnableStatic method.
|
|
|
|
|
Thanks for your response,Dave. I think I have this one almost worked out with the exception of the following.
strIPAddress = "192.168.1.141"
strsubnetMask(0) = "255.255.255.0"
strGateway(0) = "192.168.1.1"
strGatewayMetric(0) = 1
For Each objNetAdapter In colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIPAddress, strsubnetMask)
errGateways = objNetAdapter.SetGateways(strGateway, strGatewayMetric)
Next
The MSDN web site indicates passing the ipaddress variable into the Array(string) function prior to calling EnableStatic. There is no support for the array function in .net. Using conventional 1-demensional arrays throws a type mis-match exception. The exception is just a pretty unhelpful "type mismatch" message. Anyone see something i am missing?
dave
|
|
|
|
|
First, the IPAddress is not a string array, which is what EnableStatic expects.
Dim ipAddresses() As String = {"192.168.0.1"}
Next, you're setting the IP address of ALL the network adapters to the same address. You CANNOT do that!! You have to do it on the SINGLE adapter that is the network connection that you are changing, NOT ALL OF THEM!! There are more adapters in the system than appear in the Network Neighborhood properties box...
|
|
|
|
|
I am trying to make my connection string variable using application settings under Project properties. Here is my connection string when it is hard coded:
Dim myConnString As String = "Provider=Microsoft.Jet.OleDB.4.0;Data Source=" & Application.StartupPath & "\File.mdb"
When I have it hard coded it works fine. But when I try to make it variable I keep getting the error: Format of the initialization string does not conform to specification starting at index 33.
For the connection string value, I have the same code as posted above and I placed the following in the code: Dim myConnstring As String = My.Settings.ConnectionString
ConnectionString is the name of the value in application settings.
Can anyone help me with this connection string please. I know it may seem easy but I can't get it to work.
jds1207
|
|
|
|
|
Putting
"Provider=Microsoft.Jet.OleDB.4.0;Data Source=" & Application.StartupPath & "\File.mdb" in the settings won't work. You have to write some code to retrieve a complete string, like:
Provider=Microsoft.Jet.OleDB.4.0;Data Source={0}
from the config file, then replace the {0} with the value returned by Application.StartupPath .
Public Shared Function GetConnectionString() As String
Dim configString As String = My.Settings.ConnectionString
' Replace the {0} with the value from StartupPath.
' As a side, you can either pass in the filename of the database, or retrieve that
' from a setting in the config file also.
Return String.Format(configString, Path.Combine(Application.StartupPath, "File.mdb"))
End Function
|
|
|
|
|
Thanks, that worked great!
jds1207
|
|
|
|
|
Hi,
I have to wokr out in an application where user can write/open/save letters. Then I have to mail merge that letter with the data source I have. I use MS Access and Vb.NET 2005.
Also, I should have basic word features like in any mail - B, I, U, Align, etc.
I am wondering how can I do it - If i save the letter in a doc file, then how to perform the mail merge thing. Usualy mal merge in word has <<firstname>> ... such tags & data is set for those tags & process is done. How can and how sould I perform the activities.
Please help me out. I am in a hurry, looking from couple of days for this problem but couldn't find any substantial help line.
Any help is appreciated.
Thanks
Trupti
Thanks
Terry
|
|
|
|
|
Trupti Mehta wrote: I am wondering how can I do it - If i save the letter in a doc file, then how to perform the mail merge thing. Usualy mal merge in word has <<firstname>> ... such tags & data is set for those tags & process is done. How can and how sould I perform the activities.
If the user already has Word, why are you trying to re-invent it??
Or are you making your own document editor and trying to do MailMerge yourself??? If so, the merge part is easy. Your user is going to have to type fields into the document using some format you specify, like <<firstname>> , then you retrieve your results from the database and do a simple search and replace, matching the field names in the database results to the ones specified in the document.
|
|
|
|