|
Suppose you want to fill the value in column 2 then use CellEnter event of datagridview as follows.
Private Sub dgv1_CellEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv1.CellEnter<br />
<br />
If e.ColumnIndex = 1 Then<br />
ComboBox1.Visible = True 'comboBox1 is combo box which contains multiple item<br />
ComboBox1.Left = dgv1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, False).Left + dgv1.Left<br />
ComboBox1.Top = dgv1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, False).Top + dgv1.Top<br />
ComboBox1.BringToFront()<br />
<br />
RowIndexForComboHandling = e.RowIndex<br />
ComboBox1.Text = dgv1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value<br />
ComboBox1.Width = dgv1.Columns(1).Width<br />
Else<br />
ComboBox1.Visible = False<br />
End If<br />
<br />
End Sub<br />
and this is the lost focus event of combobox1
Private Sub ComboBox1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.LostFocus<br />
If ComboBox1.Text.Trim <> "" Then<br />
dgv1.CurrentCell.Value = ComboBox1.Text<br />
End If<br />
dgv1.Focus()<br />
dgv1.CurrentCell = dgv1.Rows(dgv1.CurrentCell.RowIndex).Cells(dgv1.CurrentCell.ColumnIndex + 1)<br />
comboBox1.visible=false End Sub
hope this helps
|
|
|
|
|
Hi All,
I got a requirement, "To retrieve the list of machine names in which a particular user is logged on to,in an Active Directory."
Any suggestions please ..
Thanks & Regards,
Chaitanya.
|
|
|
|
|
You can't find out. AD doesn't track that information.
|
|
|
|
|
Man, would be sweet if it did though
|
|
|
|
|
I have an application which allows the user to select multiple combo boxes and then display data in a datagrid view depending on what is selected in the combo boxes.
However, one of my fields is called 'Fee'. Obviously, this is a decimal value, I am trying to use a combo box to select a range of fees (0 - 150, 151 - 200 etc).
For the other 3 combo boxes on the form, the values are coming from a stored procedure, however, i cannot do this for the 'fee' field because i receive errors when it tries to convert to decimal.
The text in my combo box will be like the example above (0 - 150) but the values in the database are formatted differently (150.00, 170.20).
My question is, how would i be able to filter out results in my datagrid view by using a range on the 'fee' field, i thought about a case statement but at the moment it just brings back a datagrid with 'rowerrors' as a column title.
|
|
|
|
|
You asked this question 2 days ago - did you try what was listed?
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
I want to extract folder images from folders that contain music albums. These images are shows using the thumbnail view on my explorer. I want to extract them using Visual Basic. I have version 5. I have tried to use shell32 but cannot seem to get it to work. I have seen articles referring to system.icon constructs but I cannot seem to find the correct library on my computer. Any help is appreciated.
Ron C
|
|
|
|
|
The album artwork which is used to generate the folder icon, is stored in the folder containing the music files, as a jpeg image. I believe the image files are hidden by default.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Thanks, but they do not seem to be there. I am displaying hidden files and they do not show.
|
|
|
|
|
I think what you are seeing are album art images stored in the meta-data of the audio file. For example the ID3 tags of an MP3 file can be used to store images of the album cover and such. This stuff is usually displayed on the fly by enumerating the files and then reading their meta-data.
|
|
|
|
|
Thanks.
The files in question are all .wma files. They are much more difficult to parse than mp3 files. I have examined them in raw form and cannot seem to find anything that looks like a jpg or image. Any suggestions?
|
|
|
|
|
hobbitdome wrote: I have version 5.
Scrap it. You can get VB.NET 2008 Express Edition for free here[^].
|
|
|
|
|
Thanks.
I am a little reluctant to switch VB versions unless I can keep the VB5 stuff also. I have a tremendous amount of code developed in VB5 and when I have looked at upgrading, problems always appear (incompatible controls, etc). Can the VB.NET 2008 Express Edition co-exist with VB5 or will it overwrite my controls?
|
|
|
|
|
It'll coexist quite easily, but here's a little motivation. The VB5 and 6 runtimes are not supported under Windows 7.
|
|
|
|
|
Hello Sir/ Madam.
I am using MSComm object in VB.net but it is showing error. if same code working in VB 6.0.
The Code is:
Dim lblErrPort As System.Windows.Forms.Label
On Error GoTo lblErrPort
btnstart.Enabled = False
If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
With MSComm1
.RThreshold = 1
.Settings = strbaud & "n,8,1"
End With
If MSComm1.PortOpen = False Then
MSComm1.CommPort = intportno + 1
MSComm1.PortOpen = True
End If
'Timer2.Enabled = True
btnstop.Enabled = True
Exit Sub
lblErrPort:
If Err.Number = 8002 Then
MsgBox("System doesn't having comport : " & intportno + 1, MsgBoxStyle.Critical, "Commport selection")
btnstart.Enabled = True
btnstart.Focus()
ElseIf Err.Number = 8005 Then
MsgBox("comport : " & intportno + 1 & " is already opened.", MsgBoxStyle.Critical, "Commport selection")
btnstart.Enabled = True
btnstart.Focus()
Else
MsgBox("Error Number : " & Err.Number & (Chr(13)) & vbNewLine & "," & Err.Description, MsgBoxStyle.Critical, "Communication starting")
End If
.Settings = strbaud & "n,8,1" Error Line.
If i use Error Handler statement it is showing Runtime Error 380.
If I remove Error Handler statement then it is showing like this
Message: "Exception from HRESULT: 0x800A017C (CTL_E_INVALIDPROPERTYVALUE)"
Error Code: -2146827908
Any one Help me plz
|
|
|
|
|
The error message suggests that you are trying to use some invalid value in the settings. What does strbaud contain?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
strbaud is Global Integer Variable.
This will contain bandwidth. Normally it contain 9600.
|
|
|
|
|
try this....
replace
.settings =strbuad & "n,8,1"
with
.settings = str(strbuad) & ",n,8,1"
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
in my application i want to disable or visible a perticular cell in datagridview in load time the grid by coding
i write just like this
me.gridview1.row(2).cells(4).visible = false
in this coding that give me the error of readonly properity
can i visible or disable to perform in perticular cell please help me in this and give me some example please it's urgant....
|
|
|
|
|
I don't think you can hide a cell, you can hide a row or column and you may have control of enable on the cell.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
As the previous poster said, I don't think you can hide a cell but you can disable it with the 'ReadOnly' property. i.e.
me.gridview1.row(2).cells(4).ReadOnly = true
|
|
|
|
|
Thanks to Replay
I know that this thing ?
if u have a some idea of cell will be visibel false so please give me some example
modified on Wednesday, January 7, 2009 7:10 AM
|
|
|
|
|
You can't make a cell invisible, well at least I pretty sure you can't. Ypu can make an entire column invisible but not a single cell. All you can do is disable it by making it readonly.
For what purpose do you want the cell not to be visible? Maybe there is another solution to your problem.
|
|
|
|
|
that's use in userrigths
1) in my application first i fill all data in the datagridview through dataset
2) than after i want to give the rights like add,update and delete
3) in my application the delete are not in some form so that not display in gridview just that's purpose i want to not show that perticular cell in datagridvie
my datagridview look like this
colum 1 colum 2 colum 3 colum 4 colum 5 colum 6 colum 7 colum 8
checkbox formname checkbox add checkbox delete checkbox update
remark: checkbox manse thats are checkbox cell
Add: Add meanse that's just the heading of colum 5 of the checkbox of add rigths
example :
in my shiftmaster form delete are not in so in that time in grid view the colum 5 and colum 6 are not display
if u have a another idea so please give me thanks you
|
|
|
|
|
I would highly suggest changing your design. You can NOT hide individual cells in a DataGridView. Changing the colors of the cell so the foreground matches the background also will not work because the user can just select the contents of the cell to invert the color of the background. The only way I can think of doing this would be to override the drawing of the DataGridViewColumn this data is in and paint it only if your conditions are met. But, this is quite a bit work to pull off and way beyond the scope of a forum post. I suggest Google for something like "Ownerdraw DataGridViewColumn" for examples.
|
|
|
|