|
on the selected item changed event:
If the selecteditem is equal to what you specify then perform your action. i.e.
If combobox1.selecteditem = "example" then<br />
textbox1.enabled = true<br />
end if
|
|
|
|
|
When a form loads, a button is disabled. How can I get the button enabled after selecting an item in a combo box?
|
|
|
|
|
Put
myButton.Enabled = True
in the event handler for the combo box selection changed event.
|
|
|
|
|
Can anyone please help with using multiple forms. I am trying to have more than one form on a program, so that data is shared between both those forms.
|
|
|
|
|
dexter9703 wrote: Can anyone please help with using multiple forms. I am trying to have more than one form on a program, so that data is shared between both those forms.
That's a bit vague. What exactly are you having a problem with?
Do you need to know how to open mulitple forms simultaneously?
SomeForm form = new SomeForm();
form.Show();
SomeForm is the name of your Form class.
Do you need to know how to pass data between forms?
Passing values between forms[^]
Something else?
|
|
|
|
|
How can i select utf-8 encoded character fro ma text file and bind it to dataset.
Here is the code:
Dim srStreamReader As StreamReader
Dim sFile As String = "E:\FTPROOT\uni.txt"
Dim swfile As String = "E:\FTPROOT\"
Dim sFileText As String
srStreamReader = New StreamReader(sFile, Encoding.Default)
sFileText = srStreamReader.ReadToEnd()
srStreamReader.Close()
Dim swStreamWriter As TextWriter = New StreamWriter(swfile & "Import.txt", True)
swStreamWriter.Write(sFileText)
swStreamWriter.Close()
Dim _Dataset As New DataSet
'txt convertion and filling to dataset
Dim sConnectionString As String
sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & swfile & ";Extended Properties=text"
Dim objConn As New System.Data.OleDb.OleDbConnection(sConnectionString)
objConn.Open()
Dim da As New System.Data.OleDb.OleDbDataAdapter("Select * from Import.txt", objConn) ''NLS_CHARACTERSET'
da.Fill(_Dataset, "test")
This code select from text file but not in correct format.
|
|
|
|
|
Hi all,
I am using this code to loop through the SQLDataReader.
'drResource - SQLDataReader
If drResource.HasRows Then
Do While drResource.Read
'Here I have to check whether there exist next read.
Loop
End if
How can I check there is a next row
Thanks
Dana
|
|
|
|
|
danasegaranea wrote: How can I check there is a next row
You can't. All you can do is call the Read method to advance the DataReader to the next row and examine the return value from this method which indicates whether another row was available.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
I have made up a custom control which generates thumbnails from a given list of images and displays them as pictureboxes in a panel. What I can't figure out is a way of giving the panel a focus so that once you click on one picture, you can then move around the thumbnails in the panel with the arrow keys. I have created selectnextthumb / selectprevthumb subs but how can I call these when the user presses the arrow keys. Even with a form keydown event it just cycles to the next control.
Thanks in advace,
Russell
|
|
|
|
|
Look into replacing the Panel with a boardless Form instead. The Panel control never get the input focus so it never fires off keyboard events. Forms do.
The key property of a Form you're looking for is TopLevel. Set it to false and you can treat the Form as a control, just like the Panel. The Form has a KeyPreview property that will let you handle the Form's Key events and control which PictureBox to select.
|
|
|
|
|
That's a great idea. Thanks for the input.
One thing I have been considering doing as well is using GDI+ to draw the images directly and keeping control of the regions and filenames through arrays. Although this would require more code, I think it's likely to be a more responsive way of presenting the thumbnails. Is this something I should bother to look into, or is utilising picturebox controls going to remain so much easier it's not worth it?
Cheers
Russell
|
|
|
|
|
Ditch the PictureBox's. Unless you need to handle click events on the thimbnail images, you can draw them yoursefl without all the weight of the PB's. If you need to handle click events on the pictures, use the PictureBox, or create your own class to show the images inheriting from Panel.
|
|
|
|
|
Do you think I could use the click events on the form and keep an array of the regions of each thumbnail and deal with them that way? That would mean the least amount of control overheads I think.
Cheers,
Russell.
|
|
|
|
|
I tend to go for encapsulation of such things, but yes, you can do that.
|
|
|
|
|
Hi all,
I have done the following code for updating my parent table - Contract. And it works sucessfully.
Try
Me.Validate()
Me.ContractBindingSource.EndEdit()
Me.ContractTableAdapter.Update(Me.ContractContractDetailDataSet.Contract)
MsgBox("Update successful")
Catch ex As Exception
MsgBox("Update failed")
End Try
End Sub
Now, I would like to insert, delete and update for the child table - ContractDetail
Its relationship is like this.
I tried something like the following but it did not work. I tried changing some variables like ContractTableAdapter to ContractDetailTableAdapter but it did not reflect any changes on my database.
Dim deletedChildRecords As ContractContractDetailDataSet.ContractDataTable = _
CType(ContractContractDetailDataSet.Contract.GetChanges(Data.DataRowState.Deleted), ContractContractDetailDataSet.ContractDataTable)
Dim newChildRecords As ContractContractDetailDataSet.ContractDataTable = _
CType(ContractContractDetailDataSet.Contract.GetChanges(Data.DataRowState.Added), ContractContractDetailDataSet.ContractDataTable)
Dim modifiedChildRecords As ContractContractDetailDataSet.ContractDataTable = _
CType(ContractContractDetailDataSet.Contract.GetChanges(Data.DataRowState.Modified), ContractContractDetailDataSet.ContractDataTable)
Try
If deletedChildRecords IsNot Nothing Then
ContractTableAdapter.Update(deletedChildRecords)
End If
ContractTableAdapter.Update(ContractContractDetailDataSet.Contract)
If newChildRecords IsNot Nothing Then
ContractTableAdapter.Update(newChildRecords)
End If
If modifiedChildRecords IsNot Nothing Then
ContractTableAdapter.Update(modifiedChildRecords)
End If
ContractContractDetailDataSet.AcceptChanges()
Catch ex As Exception
MessageBox.Show("An error occurred during the update process")
' Add code to handle error here.
Finally
If deletedChildRecords IsNot Nothing Then
deletedChildRecords.Dispose()
End If
If newChildRecords IsNot Nothing Then
newChildRecords.Dispose()
End If
If modifiedChildRecords IsNot Nothing Then
modifiedChildRecords.Dispose()
End If
End Try
End Sub
These are the components that are created.
Any help is greatly appreciated. Thanks!
telly
|
|
|
|
|
I cannot modify the above post because the edit button have been shift to the right and the message board cannot be scroll through.
But you can click on Reply to read the codes at the back.
Thanks for any help!
telly
|
|
|
|
|
Sub Foo(Optional _string as String = String.Empty)
^ Error ¿?
Creador de sueños, títere en una realidad efímera y tardía.
|
|
|
|
|
You might want to actually explain the error message you get instead of attempting to "point" to the problem, which didn't work as you expected.
You have to specify the default value of a String in quotes, not using String.Empty:
Sub Foo(Optional _string As String = "")
|
|
|
|
|
You need to be a bit more descriptive about your problem.
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
I created a setup for my small application using the click once deployment method.But I also want to execute another *.exe file in setup the process. i.e. I want to execute another *.exe file after the setup has been completed.
Do you guys know how to do it?
|
|
|
|
|
You don't have an option to run an "after install" custom action while using ClickOnce. it's not supported at all.
A better soultion would be to have this functionality built into your application, giving it a kind of "self repair" feature. If certain items do not exist in the configuration the app is expecting, call your setup process.
|
|
|
|
|
How do I get the selected value from a combo box and use it in a database update.
This is the code to update the datarows. I am not sure what hte syntax is or the method, etc for getting the selected value which is also the primary key of the database table.
' Locate the row you want to update.<br />
Dim ssRow() As Data.DataRow<br />
ssRow = lpDataSet.Tables("tbl_store_sched").Select("ss_id = ")
|
|
|
|
|
AAGTHosting wrote: How do I get the selected value from a combo box and use it in a database update.
You said it yourself. If the ComboBox is bound to a DataTable, ComboBox1.SelectedValue returns the value of the selected item in the combo.
|
|
|
|
|
I'm writing a console application. I am trying to change directory path.
I use a line like below.
Environment.CurrentDirectory = "C:\somedirectory"
The line compiles, runs without throwing an exception, but does not change the directory.
Any other commands or tricks to try?
|
|
|
|
|
You can't do what you trying to do.
Changing the "current directory" only does so for the current process, i.e.: your app. Any changes you make the the "current directory" do not get reflected by the shell that launched your app. The shell (CMD) maintains its own "current directory".
|
|
|
|