|
When your user logins to the application, you should probably pull their schedule from the database and put it into a DataTable. This will enable you to quickly evaluate their selections against their pre-existing database content without having to make round-trips back and forth to the database.
Secondly, when the application begins running, you might want to enumerate all of your checkboxes against the DataTable, to find out which ones should be selected and which ones should not be selected, according to the database information stored in the DataTable.
Next, when a CheckBox event Checked is raised, you can take the arguments and pass them to the dataTable to see if they conflict with any data on file. If not, then write to your datatable the new data.
Just be sure to update the DataSource from your DataTable with a DataAdapter once you're finished.
Jonathan Sampson
www.SampsonResume.com
|
|
|
|
|
Thanks a bunch. I just had to keep going because of time constraint and somehow managed to do it. I was actually saving the contents in an arraylist so I didn't have to make round trips.
Thanks once again.
Yoshimitsu
|
|
|
|
|
So, my foray into VBA continues. Under Excel, I am developing a financial application. This is my first time using VBA, so I am a little clueless on certain (simple) things. The problem I have is the following:
I have data stored in an array that I write to a column in Excel. The length of the array can vary from calculation to calculation. Thus, I write the data from the array to the A column on the spreadsheet. Let's say the length of the array is n. So I write n elements to column A on the Excel spreadsheet. Now, I am trying to get excel to automatically plot the data in column A on a graph, but n is variable. So in one instance n may be 100. In another n may be 233, for example. The problem is that I don't know how to automatically determine the length of the column so that I can plot the data on an Excel chart. Any assistance would be appreciated.
Thanks in advance.
|
|
|
|
|
Use the Chart object, as in the following sample:
Dim MyArray(4) As Long
MyArray(0) = -5: MyArray(1) = 1: MyArray(2) = 2: MyArray(3) = 4: MyArray(4) = 7
With Worksheets(1)
Set a = .ChartObjects(1).Chart
.ChartObjects(1).Chart.SeriesCollection(1).Values = MyArray
End With
Hope that's useful
|
|
|
|
|
Chapter 6 "Using Excel's Range and Chart Objects" of Microsoft Office 2000 Visual Basic for Applicatio - fundamentals - might help. I will send the text of "Using Excel's Range and Chart Objects" to by e-mail via CP.
modified 1-Aug-19 21:02pm.
|
|
|
|
|
Richard A. Abbott wrote: Chapter 6 "Using Excel's Range and Chart Objects" of Microsoft Office 2000 Visual Basic for Applicatio - fundamentals - might help. I will send the text of "Using Excel's Range and Chart Objects" to by e-mail via CP.
Ah, that would be great, thanks. I don't have any reference books handy! (As you can probably tell...)
|
|
|
|
|
When my application runs on a certain HP computer the last letter on each label on the form is cut off making the labels illegable. On all other computers we installed the application on the labels look fine. Why doesn't the HP computer display the labels correctly?
|
|
|
|
|
I think its a problem with the resolution on that computer
|
|
|
|
|
Your label boxes are being cut off because your form's layout doesn't allow for different DPI settings or resolutions. I'd direct you to the documentation and some articles on MSDN on the subject, but the MSDN site isn't responding right now.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks.
I changed the AutoResizeMode = dpi
This fixed everthing except for some of the label controls. The code defines the location of some of the labels on the form at runtime. The code bases the locations on a 96dpi but if the app runs on a computer with a different dpi the labels are put in the wrong spot. I think I need to know the computer's dpi when calculating the locations of these labels. How can I get that?
|
|
|
|
|
If think your talking about AutoSizeMode , not ...ResizeMode. If the AutoSizeMode is set to DPI, then you can checks the Forms CurrentAutoScaleDimensions property. It'll return a SizeF object with the current DPI of the screen.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi there,
I am working on an application which checks the remote computer running WinXP/2k that wheather it is locked or not. I have searched every where but not able to find the solution . there is one article on this issue but it only determines the state of the local computer means application have to be installed on local computer. whereas in my case the application will run from central computer w:(hich shall check the status of remote computers on local LAN.
Please help me in this regard
Thanks
Muhammad Farhan Farooq
|
|
|
|
|
There is no way to determine the workstation status without code running on each workstation you want to check. Even then, there is no function you can call that will tell you if the workstation is locked or not. It must be deduced using other methods. You can read more about a possible solution here[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi All,
Can anyone tell me how to load the form in a maximized way.
|
|
|
|
|
Me.WindowState = FormWindowState.Maximized
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
|
running vb.net 2005 & sql 2005
Ive been trying to add what seemed a simple table to a form ... only three four fields plus an update and cancel button
I managed to ( from samples ) add an OleDbConnection connecton, a OleDbDataAdapter complete with select and update commands and a dataset . From previous samples ( win 2003 dataform ) i have the four text boxex reporting back the data from the dataset ... Stage 1 complete. now here is where i was comming a cropper, when trying to update the table i used the following commands
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
Try
'Attempt to update the datasource.
Me.UpdateDataSet()
MsgBox(" Update sucessful")
Catch eUpdate As System.Exception
'Add your error handling code here.
'Display error message, if any.
System.Windows.Forms.MessageBox.Show(eUpdate.Message)
End Try
End Sub
Public Sub UpdateDataSet()
'Create a new dataset to hold the changes that have been made to the main dataset.
Dim objDataSetChanges As Boss.net.DebBacsFmDestAccs = New Boss.net.DebBacsFmDestAccs
'Stop any current edits.
Me.BindingContext(DebBacsFMDestAccounts1, "DebBacsFmDestAccs").EndCurrentEdit()
'Get the changes that have been made to the main dataset.
objDataSetChanges = CType(DebBacsFMDestAccounts1.GetChanges, Boss.net.DebBacsFmDestAccs)
'Check to see if any changes have been made.
If (Not (objDataSetChanges) Is Nothing) Then
Try
'There are changes that need to be made, so attempt to update the datasource by
'calling the update method and passing the dataset and any parameters.
Me.UpdateDataSource(objDataSetChanges)
DebBacsFMDestAccounts1.Merge(objDataSetChanges)
DebBacsFMDestAccounts1.AcceptChanges()
Catch eUpdate As System.Exception
'Add your error handling code here.
Throw eUpdate
End Try
'Add your code to check the returned dataset for any errors that may have been
'pushed into the row object's error.
End If
End Sub
Public Sub UpdateDataSource(ByVal ChangedRows As Boss.net.DebBacsFmDestAccs)
Try
'The data source only needs to be updated if there are changes pending.
If (Not (ChangedRows) Is Nothing) Then
'Open the connection.
Me.OleDbConnection1.Open()
'Attempt to update the data source.
OleDbDataAdapter1.Update(ChangedRows)
End If
Catch updateException As System.Exception
'Add your error handling code here.
Throw updateException
Finally
'Close the connection whether or not the exception was thrown.
Me.OleDbConnection1.Close()
End Try
End Sub
The eupdate throws the following error
"Child list for field DebBacsFmDestAccs cannot be created"
Im at a loss as to what to do now, please can anybody help
I really do need help..... all this computer stuff is way over my head !!
|
|
|
|
|
the problem is I'm designing a dataform which is liked with sql server 2000 table , on the table i have tree or more choices and I want the user to choose only one of them , i use for it a group of RadioButton but i can't binding it to the database
how can i Binding data to the radiobutton ,
thanks for all
jooooo
|
|
|
|
|
|
I don't think anyone can understand the Question, what is you want to bind the Radio buttons to? Do you want the radio button text to come from the Database? Or the useres selection be logged in the database?
|
|
|
|
|
Thanks my friend
i mean bind the Radio buttons to the useres selection to be logged in the database not the text of it
i wait you
jooooo
|
|
|
|
|
I don't think Binding the radio buttons to a database is even possible in that manner, and if it is I don't think its the right way to go about it.
What you would probably want to do is handle the RadioButton.CheckChaged Event and then do an insert or update statement using a SLQDataAdapter or SQLCommand.
Kevin
|
|
|
|
|
Thanks Kevin
I use the Radio button to binding to field on the table
for ex :
on the table the user will choose between three cases ,
the method of Stock evaluation : choose on
1- FIFO
2- LIFO
3- Cost Average
I want to make the three choice as Radio button and binding it to the tree fields on database
i'm waiting your reply eagly
jooooo
|
|
|
|
|
That was pretty vague but if I understand correctly there are 3 fields in a table in the database, and you want to use the radio buttons to choose which field to select from?
<br />
dim Field as string<br />
IF rdb1.checked THEN<br />
field = 'field name<br />
else if rdb2.checked THEN<br />
field = 'field name 2<br />
else<br />
field = 'field name 3<br />
end if<br />
Thas pretty bad programing style but for purpose of explination it will suffice
Now you perform the select statement
<br />
SomeAdapter.SelectCommand.CommandText = "SELECT " & Field & " FROM some table WHERE somecontraints<br />
hope that helps
|
|
|
|
|
how can i develop a vb.net pocket pc application using oracle as the database?
isha
|
|
|
|