|
got it. thank u so much.
the very last question. do u have a piece of code of this -> ctlGridItems(6, mCurRow) .
honestly, u help me a lot. I hate this f***ing datagridviewcombobox. actually, i have a project that has
4 combobox which can be editable by the user.i have this already in MS Access form but when I implement in visual studio 2005. i don't have any idea on how to do it. thank u very much once again.
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
No Problem , pleasure is all mine, i could not forget my days when i used to struggle every one starts from down to up but the key is to keep doing , i believes on that Problem is the Gateway to Success/Development
ctlGridItems(6, mCurRow) = cmb
where cmb is "Dim cmb As New DataGridViewComboBoxCell"
ctlGridItems(6, mCurRow)
(column,Row)
you can call populating of combobox on
Private Sub ctlGridItems_CellEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles ctlGridItems.CellEnter
mCurRow = e.RowIndex
If e.ColumnIndex = 6 Then
call urRoutine
end if
end sub
mCurRow is an int variable,
Best Of Regards,
SOFTDEV
Sad like books with torn pages, sad like unfinished stories ...
|
|
|
|
|
hi softdev_sup
i don't have error anymore, the problem is still here
ctlGridItems(6, mCurRow) = cmb , i think so.
no data will show, even the combobobox doesn't show. its only datagridview. do i miss something.
this is what i've done.
Private Sub FillUnits()
Dim mCls As lgCls = New lgCls
Dim counter As Integer
With MyDataGrid
Dim cmb As New DataGridViewComboBoxCell
For counter = 0 To mCls.List_AllMethods.Count - 1
cmb.Items.Add(mCls.List_AllMethods.Item(counter).ToString())
Next
MyDataGrid(2, mCurRow) = cmb
End With
End Sub
Private Sub MyDataGrid_CellEnter(ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles MyDataGrid.CellEnter
mCurRow = e.RowIndex
If e.ColumnIndex = 6 Then
End If
End Sub
where mCurRow is declared here
Public Class MyForm<br />
Dim mCurRow As Integer
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
=-=-=-=-=-- MyDataGrid(2, mCurRow) = cmb =-=-=-=-=--=-=-=-=-=--
SEE YOURS COLUMN NO IS 2
=-=-=-=-=-=-=-=-=If e.ColumnIndex = 6 Then-=-=-=-=-=-=-=-=-=-=-
HERE U R USING 6 IT SHOULD BE UR LOOKUP COLUMN I BELIEVE ITS 2
Best Of Regards,
SOFTDEV
Sad like books with torn pages, sad like unfinished stories ...
|
|
|
|
|
thanks for the last day reply.
by the way, can i apply this on my 2nd and 3rd combobox and so on... would it be possible to use and how? is it ok that you can share to me your entire code regarding editable datagridviewcombobox.
thanks again.
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
Off course , You can use it for other columns also , this is the whole code their is nothing else ,
you have to make following changes
''in class
Sub New(ByVal URS_VARIABLE As String)
''URS_VARIABLE = URSPROPERTY
''Here
End Sub
Private Sub ctlGridItems_CellEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles ctlGridItems.CellEnter
mCurRow = e.RowIndex
If e.ColumnIndex = URS_COLUMNSNO Then
call urRoutine
end if
end sub
=-=-=-=-=-- MyDataGrid(URS_COLUMN_No, mCurRow) = cmb =-=-=-=-=--=-=-=-=-=--
Best Of Regards,
SOFTDEV
Sad like books with torn pages, sad like unfinished stories ...
|
|
|
|
|
sorry to disturb you again, i would like to ask something..
another thing is, what if the combobox is a databound. can i still edit that item inside the combobox, i almost got this dgvcombobox thing. but when i add the new item inside the combobox(column1) then click next combobox(column2), the combobox(column1) is empty string but when i click the dropdown, the added item is there. i want to show the added item on that combobox(column1).
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
i think so when you populates second combo then you are still referencing somewhere yours 1st combo thats why the value disapperars
Best Of Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
if you are still having problem then their is one more alternate easier way
Public Function FillUnit(ByVal mCmbBox As ComboBox) As Boolean
Dim _Fill_SUnit As String = "select unit_Name from Unit_Master"
Dim con As New SqlConnection(gConnectionString)
Dim cmd As New SqlCommand(_Fill_SUnit), con)
con.Open()
Dim dr As SqlDataReader = cmd.ExecuteReader()
mCmbBox.Items.Add("")
While dr.Read()
mCmbBox.Items.Add(dr.Item("Unit_Name").ToString)
End While
dr.Close()
con.Close()
Return True
End Function
Function fillCombos() As Boolean
call FillUnit("ComboBox")
Return True
End Function
form load ()
If fillCombos() = False Then
lblStatus.Text = Err_Load
End If
Dim dgvcboOperator As New DataGridViewComboBoxColumn
With dgvcboOperator
.DataPropertyName = "ColOperator" : .DataSource = cboOperator.Items : .HeaderText = "Sub Unit"
End With
ctlGrid.Columns.Remove("ColOperator") : ctlGrid.Columns.Insert(2, dgvcboOperator)
end sub
place a combobox control which is not shown on the form then populate this combobox with your data and set your grid column combo equal to this combobox
Best Of Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
just to tell you that all now are working fine and thank u so much.
another question:
how to load the selected item? example; in combo i have item1,item2,item3. then i select item3 then save to database. when i load again the form. the combo should default to that selected item which save in db. i can make it in a normal combo, by assigning the combo.text value from db.
sorry again for disturbing you.
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
No problem in your query which fills up the Combo just add one clause order by id desc and it will show you the last value
Best Of Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
opps sorry. thats not what i mean. its not the last value item. its the selected item. meaning, if i have items 'a','b','c','d', and so on... then user select b then save to db.
then close form. when re-open form. the value of combo shud b or whatever. what i want is like a normal combo.
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
SelectedIndex , SelectedItem,SelectedText,SelectedValue will do the job
Best Of Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
I have a datagridview with a DataGridViewComboboxColumn column with 3 values:
"Small", "Medium", "Large"
I get back the users default which in this case is "Medium"
I want to show a comboboxcell in the datagridview but default the value to "Medium". i would do this in a regular combobox by doing selected index or just setting the Text property of a combo box.
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
I am trying to write the data in Textbox1 to a certain location in the text file say 10 lines down and 10 line to the right
is this posible with streamWriter ??
Thanks
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim file As System.IO.StreamWriter
file = My.Computer.FileSystem.OpenTextFileWriter("c:\test.txt", True)
file.WriteLine(TextBox1.Text)
file.Close()
End Sub
|
|
|
|
|
Bob Beaubien wrote: is this posible with streamWriter
Yes... and No.
Yes you can write to a text file, you can even read in the first 9 lines and then write your info into the 10th line.
No you can't write the 10th line to the right you can of course insert 10 spaces before the textbox info.
|
|
|
|
|
Right on how would i do that ??? if you dont mind me asking
Pleasse and thanks
|
|
|
|
|
Excuse the sarcasm - we really need a rude/sarcasm icon
You know how to use the stream writer
You are using writeline - I assume you can count to 10
If you cannot add 10 spaces to the left of the textbox.text then there is no hope at all.
when finished remember to add stream.close() (you don't need flush() - thank you Luc).
I hope I'm not feeding a troll, your question is so basic it does make me wonder.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I tryed that it did not work just just moves right back i guess it would probably be easyer using a excel spredcheet and remove the lins when printing
|
|
|
|
|
I regret the inconvenience caused with the lengthy code pasted earlier.I'll put my query again.
I am using a front end to enter some records.However for a particular record the update button is greyed out.
code for update button.
Private Sub cmdUpdate0_Click()
Dim strAgreeStatus As String
Call m_frmParent.ZOrder(0)
strAgreeStatus = txtText0(idxMaintAgreeStatus).Text
If Edit_Neg > 0 Then
Exit Sub
End If
If Edit_Agree > 0 Then
Exit Sub
End If
On Error GoTo ERR_ROUTINE
Me.MousePointer = vbHourglass
If strAgreeStatus = "A" Then
m_objAgreement.DoFullEdits = "Y"
Else
m_objAgreement.DoFullEdits = "N"
End If
FMain.staMain.Panels(1).Text = ""
DoEvents
If ValidateAll0 > 0 Then
FMain.staMain.Panels(1).Text = "Unable to Update. Check fields in red."
GoTo SUBEND
End If
DoEvents
If m_objAgreement.Update < 1 Then
Call MsgBox("Agreement not found. " & vbCrLf & _
"", vbExclamation & vbOKOnly, "Unable to Update.")
Else
cboCombo0(idxMaintAgreementType).SetFocus
FMain.staMain.Panels(1).Text = "Update Successful."
End If
SUBEND:
cboCombo0(idxMaintAgreementType).SetFocus
Me.MousePointer = vbNormal
Exit Sub
ERR_ROUTINE:
If Err.Number = boAgreeErrRequired Then
Call MsgBox("Unable to Update. " & vbCrLf & vbCrLf & Err.Description, vbOKOnly, "Required Data Missing")
ElseIf Err.Number = boAgreeErrValidation Then
Call MsgBox("Unable to Update. " & vbCrLf & vbCrLf & Err.Description, vbOKOnly, "Data Validation Error")
Else
Call MsgBox("Unable to Update. " & vbCrLf & vbCrLf & Err.Description, vbOKOnly, "Error")
End If
Me.MousePointer = vbNormal
End Sub
Thanks in advance.
~Varun
|
|
|
|
|
From what you have said, I do not believe the problem is within the click event of the updaste Button.
I would suggest you use a breakpoint and step through you code and pay particular notice to anything where the Enabled property of the update button is used.
I noticed you used a GoTo command. Tut Tut, bad coding. Avoid using them, they only lead to bad code.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Thanks for your response Steve..Havn't tried it yet but definitely share it with you..Regarding the GoTo..well the code is legacy code so can't do much
Thanks
~Varun
|
|
|
|
|
Thanks a ton Steve.. My problem has been solved after a little exploration in the enable conditions.
Regards
Varun
|
|
|
|
|
Buggedforever wrote: DoEvents
Eeekkk
Buggedforever wrote: On Error GoTo ERR_ROUTINE
AAHHHHhhhh
Buggedforever wrote: GoTo SUBEND
AAAHHhhhhhh
Sorry, I was not expecting VB6, I need a shower, ergh.
There is a rule that discourages answerers from being sarcastic and rude but I just can't help it - VB6 make my skin crawl.
|
|
|
|
|
Mycroft Holmes wrote: I was not expecting VB6
Took me a couple of seconds to recoil in horror myself
I don't speak Idiot - please talk slowly and clearly
I don't know what all the fuss is about with America getting it's first black president. Zimbabwe's had one for years and he's sh*t. - Percy Drake , Shrewsbury
Driven to the arms of Heineken by the wife
|
|
|
|