|
A big THANK YOU to everyone who helped with my problem.
After taking everyone's suggestions I played around with the code and now
have it working just fine. As well I learned a lot from suggestions and
trying different things about the timers and how they work.
By the end of the weekend I should have a working program...
Thanks again...
|
|
|
|
|
NO!!!!
There is no need for PictureBox.Refresh() or anything of that nature, by assigning a new image to the picturebox it knows it needs to repaint itself and it will.
And Application.DoEvents() is evil except maybe in the hands of experts; whenever your app seems to behave better with it, you probably have done it all wrong to begin with. Do not tell other people to use it!
|
|
|
|
|
hi, my senior told me to use DevShock dll in vb.net so i can easily do networking program.
but why everytime i search devshock.net in google, i keep finding thing like asp.net.
please help me, what should i type in google..
|
|
|
|
|
Why ask us; go and talk to your senior and ask him or her where to get it from and why you need it.
Programming is work, it isn't finger painting. Luc Pattyn
|
|
|
|
|
he is already gone.
just had a fight with my manager.
i won't ask if i can do that.
|
|
|
|
|
vkstarry wrote: he is already gone.
Then forget what he suggested and go your own way.
vkstarry wrote: just had a fight with my manager.
Life is hard.
Programming is work, it isn't finger painting. Luc Pattyn
|
|
|
|
|
i'm not the one who fight with manager.
btw great answer, thank you
|
|
|
|
|
Ah, I misunderstood your previous message.
Programming is work, it isn't finger painting. Luc Pattyn
|
|
|
|
|
vkstarry wrote: btw great answer
I think you may have given me the wrong vote: 1=bad, 5=good.
Programming is work, it isn't finger painting. Luc Pattyn
|
|
|
|
|
mostly fixed.
|
|
|
|
|
Thank you, your powers are awesome.
Programming is work, it isn't finger painting. Luc Pattyn
|
|
|
|
|
DevShock looks like it's dead. You'll have to find a replacement library if you don't want to write your own.
Something like IP*Works[^].
|
|
|
|
|
Hi guys I need your smart hands to handle this code
I have three columns on (Table1DataGridView) take names: (F/T) (Last name1) (Last name2)
first column takes Bit value ( Checkedbox. true or false ) the rest of columns takes text value type.
I wonder how can I do something like this : if F/T is checked true then Last name1 equuleus the value of Last name2
I try this
Private Sub Table1DataGridView_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles Table1DataGridView.CellContentClick
If Table1DataGridView.Rows(0).Cells(0).Value.chcked =True Then
Table1DataGridView.Rows(0).Cells(1).Value=Table1DataGridView.Rows(0).Cells(2).Value
End if
End sub
then I thought I should know what is the name of F/T column and using that name to give that name my code which is las name1 = last name2
and I did this, I went to ( Edit columns option and then I copy the name of F/T column, and the Name of las nmae1,and the Name of las nmae2 ) and I did this code but I got nothing
If DataGridViewCheckBoxColumn1.TrueValue Then
DataGridViewTextBoxColumn2 = DataGridViewTextBoxColumn3
End If
I'm not sure if can did this or it's not possible, Please if you could give hand with this I will be appreciated
thanks
|
|
|
|
|
I'm not sure I understand what you are trying to achieve here or maybe it's because here in Australia it's a Monday morning, and I'm still in weekend mode.
Why would you need the contents of Column 1 to be replaced with the contents of Column 2 if the value of Column 0 is checked?
Can you possibly provide some more information on what you trying to do.
|
|
|
|
|
yes that what I need
the contents of Column 1 to be replaced with the contents of Column 2.
or on other words because I'm in USA 9:33 pm cool night and cool weather
I need to move or copy what in cell to another cell that basically what I need once Column 0 is checked true. because Column 1 will be used as Query in my project.
what I gave was just example.
I'm focus now how do this to do something else but i'm not sure if some one did like this before or if it's possible to do.
thanks
|
|
|
|
|
If what you want is change how a column looks (as opposed to what it actually contains), then you could handle the CellFormatting event and perform any calculation and formatting you fancy right there.
|
|
|
|
|
no I need to move text from cell to another cell on the same row once column 0 is checked
|
|
|
|
|
I have no idea what your problem could be, just handle the appropriate event.
MSDN doc on DataGridViewCheckBoxCell class says:
Typically, check box cell values are intended either for storage, like any other data, or for performing bulk operations. If you want to respond immediately when users click a check box cell, you can handle the DataGridView..::.CellClick event, but this event occurs before the cell value is updated. If you need the new value at the time of the click, one option is to calculate what the expected value will be based on the current value. Another approach is to commit the change immediately, and handle the DataGridView..::.CellValueChanged event to respond to it. To commit the change when the cell is clicked, you must handle the DataGridView..::.CurrentCellDirtyStateChanged event. In the handler, if the current cell is a check box cell, call the DataGridView..::.CommitEdit method and pass in the Commit value.
|
|
|
|
|
What Luc is suggesting is correct, use an event handler for the DataGridView to trigger the action you want to occur.
Is the DataGridView populated by a data table or array? Do you wish to save the changes back to the database?
But to just populate the second cell with the third cell's contents just use something like this.
'Declare a couple of variables to hold the row number and contents of the third cell
Dim pRowNo as Integer
Dim pstrContents as String
'Get the ROW number
pRowNo = Val(DataGridView.SelectedCells(0).RowIndex.ToString())
'It's here where you test if Cell 0 is checked, then if so the remainder (below) is actioned.
'Store contents of cell three
pstrContents = DataGridView.Rows(pRowNo ).Cells(2).Value
'Insert contents into cell two
DataGridView.Rows(gintROWNO).Cells(1).Value = pstrContents
(The above can be shortened, but I did it this way so you can step through to check the value being copied to "pstrContents" prior to the insert into the second cell)
It would be here you save any changes back to the data source and refresh the grid.
Does this help?
|
|
|
|
|
ok but under where I should put this code. you said
use an event handler, I'm sorry I don't how to use this feature where I can find the event handler is it something like this
Private Sub Button1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.TextChanged
End Sub
|
|
|
|
|
Hi romo22,
An event handler is just an event that is called when a user clicks on or otherwise actions a control, such as your DataGridView.
Clicking on the DataGridView, will trigger the On_Click event. The first line of code after the declaration gets the ROW number of the grid, which in turn is used to access the data from the cells. For example......
Private Sub DataGridView_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGridView.Click
'Declare a couple of variables to hold the row number and contents of the third cell
Dim pRowNo as Integer
Dim pstrContents as String
'Get the ROW number
pRowNo = Val(DataGridView.SelectedCells(0).RowIndex.ToString())
'It's here where you test if Cell 0 is checked, then if so the remainder (below) is actioned.
'Store contents of cell three
pstrContents = DataGridView.Rows(pRowNo ).Cells(2).Value
'Insert contents into cell two
DataGridView.Rows(gintROWNO).Cells(1).Value = pstrContents
End Sub
This should get you started, you will find some great examples using Google.
Remember, this will place the data in the cell but will not save ot to your data source.
|
|
|
|
|
yes it's work as super but I wonder how can make cell 1 clear once checked is false where I can add the if and else function. I will try by myself first
thanks so much I spent six hours trying with myself finally I'm done with it oh my God
Private Sub Table1DataGridView_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles Table1DataGridView.CellContentClick
Dim pRowNo As Integer
Dim pstrContents As String
pRowNo = Val(Table1DataGridView.SelectedCells(0).RowIndex.ToString())
pstrContents = Table1DataGridView.Rows(pRowNo).Cells(2).Value
Table1DataGridView.Rows(pRowNo).Cells(1).Value = pstrContents
End Sub
|
|
|
|
|
Hi JohnPayton
I tried to add if function but it doesn't work with me the code without if function work prefect
Private Sub Table1DataGridView_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles Table1DataGridView.CellContentClick
Dim pRowNo As Integer
Dim pstrContents As String
pRowNo = Val(Table1DataGridView.SelectedCells(0).RowIndex.ToString())
If Table1DataGridView.Rows(pRowNo).Cells(0).Value = True Then
pstrContents = Table1DataGridView.Rows(pRowNo).Cells(2).Value
Table1DataGridView.Rows(pRowNo).Cells(1).Value = pstrContents
Else
Table1DataGridView.Rows(pRowNo).Cells(1).Value = ""
End If
End Sub
I need to add if because once cell 0 checked= false then cell1 = clear or "" empty
could please help me with this
modified 14-May-12 4:30am.
|
|
|
|
|
Payton I still need your help where I can add if function
|
|
|
|
|
Morning romo22,
Let me understand what you are doing here....
The way I read your code at the moment is If a user clicks on a Row and Cell 0 (checkbox) is Checked, then the contents of Cell 2 are moved into Cell 1 otherwise you clear the contents of Cell 1
Are you using mouse clicks to Check and UnCheck the checkbox in Cell 0 or is it being populated by a data source?
|
|
|
|