|
Sheets(Sheet.Count(-1)).Select must be
Sheets(SheetS.Count(-1)).Select
|
|
|
|
|
DOH!!!!!
Yes, obvious now!
I can't believe I missed that!
That one goes into the "Did I really do something that stupid? Ah, I see I did' Folder.
Thanks!
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|
|
Sheets(Sheets.Count() - 1).Select
|
|
|
|
|
As my response above, missed something obvious, so that was two bleedin' obvious things in one damn line.
I am having a bad day!
Cheers.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|
If that classifies as a 'bad day' i don't know what my 'bad day' should be renamed............
Anyway, you MUPPET!
|
|
|
|
|
daveauld wrote: Anyway, you MUPPET!
Guilty as charged!
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|
I want to binary serialize a class, which has only shared items (variables & objects of different types) which I use globally in my code.
When I want to serialize it, I get the error "'EmailAccount' is a type and cannot be used as an expression" :
binformatter.Serialize(filstream, EmailAccount)
I even tried to create an object from the class and serialize it. But it seems to only save the instance variables and not the shared ones.
Is there a way to serialize them?
|
|
|
|
|
Serialzation only works on instance members. Shared, or static in C#, members are not part of any instance. You'll have to either save them sepearately or there are various methods of including the static members in the serialization, but they will be included in every single instance of the class you serialize. One method would be to create public "wrapper" properties for the shared members.
|
|
|
|
|
hi mates,
how will I use Enter key instead of Space key to check the checkboxes in datagridview? Note: checkbox is inside the unbound datagridview.
thanks in advance
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
Personally, I'd find the different behavior confusing. But, you could change the checked state in a KeyPress event or similar.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
my project only needs calculator keypad. thats why i only use specific key such as enter key. actually i have keypress event but checkbox value sometimes does not effect. heres my code snippet.
If e.KeyChar = Keys.Enter Then
If Me.C1grid.Col = 5 Then
Me.C1grid.Columns("IsOut").Value = CInt(Not CBool(Me.C1grid.Columns("IsOut").Value)) * -1
Me.C1grid.Columns("IsIn").Value = CInt(Not CBool(Me.C1grid.Columns("IsIn").Value)) * -1
End If
End If
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
Does that even compile?
Are you sure that Col = 5 ? How does your control know when Col = 5 has been selected? What row is being referred to?
Why are you changing the value of a column? A column has many cells, so which one should be changing? Or are you trying to change the value of all the cells?
To toggle a check box, you should do something like
C1grid.Item("IsOut", row_num).Value = Not C1grid.Item("IsOut", row_num).Value
for the cell you want to toggle.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Walt Fair, Jr. wrote: Are you sure that Col = 5?
yes this will work bcoz i have 10 columns but in colum 5 and 6 is checkbox.
Walt Fair, Jr. wrote: How does your control know when Col = 5 has been selected?
C1truedbgrid can handle columindex.
yes it will compile and working in C1 which i can get the colum index.in this application user doesn't have a mouse so only keypad.
this is the case, i have two colums in C1datagrid which is all checkbox.
for instance: by default all checkbox value are false.
so when user hit the enter key in column1, the checkbox value in column1 will return to true and automatically checkbox value in column2 will return to false and vice versa.
i have test this using normal key like spacebar/mouseclick and smoothly working in afterupdate event of c1truedbgrid but like i said if enter key doesnt work in afterupdate event so i use the keypress event which is you suggest at first.
example:
Private Sub C1grid_AfterColUpdate(ByVal sender As System.Object,ByVal e As C1.Win.C1TrueDBGrid.ColEventArgs)Handles C1grid.AfterColUpdate
If e.ColIndex = 1 Then
'first checkbox
If CBool(Me.C1grid.Columns("NDFlag").Value) = True Then
'second checkbox
Me.C1grid.Columns("KMFlag").Value = False
Else
Me.C1grid.Columns("KMFlag").Value = True
End If
ElseIf e.ColIndex = 2 Then
'second checkbox
If CBool(Me.C1grid.Columns("KMFlag").Value) = True Then
'first checkbox
Me.C1grid.Columns("NDFlag").Value = False
Else
Me.C1grid.Columns("NDFlag").Value = True
End If
EndIf
End Sub
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
modified on Wednesday, May 26, 2010 12:51 AM
|
|
|
|
|
If e.ColIndex = 1 Then
Me.C1grid.Columns("KMFlag").Value = NOT CBool(Me.C1grid.Columns("NDFlag").Value)
ElseIf e.ColIndex = 2 Then
Me.C1grid.Columns("NDFlag").Value = NOT CBool(Me.C1grid.Columns("KMFlag").Value)
EndIf
is equivalent.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
your suggested code will only work in spacebar or mouse click. what if i will use ALT-key to trigger the checkbox value in a grid?
How will i do that? Help. i need this to work.
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
OK, then you'll need to trap the KeyDown event. The Enter key causes validation and a change in cell by default.
BTW, e.KeyChar = Keys.Enter gives a type error here.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
The problem is I have two sides to my program one where general users can access my MSFlexGrids, three in total which are all stored and separate text files; and on the other side of the program I am updating the flexgrids which then save to files, which all works fine as shown below now what I’m looking to do now is to update one flexgrid such as my race one which contains details such as drivers name, team and positions for races such as 1st, 2nd, 3rd, then when this updates it also uses the positions to convert it into point values 10 and descending then have it write to other flexgrid/s for that particular driver now I no I need to use arrays I’m considering dynamic for expansion later on and I have been through it in my head and seems simple to explain but I’m having trouble even knowing where to start implementing this part so any help would be appreciated. If any more details are needed please ask. Thanks in advance.
Private Sub FillGridFromFile()
'code that reads from text file
Dim lRow As Long
Dim lCol As Long
Dim lFile As Long
Dim sFilepath As String
Dim sline As String
Dim vData As Variant
Dim strExist As String
MSFlexGrid1.FixedCols = 0
MSFlexGrid1.FixedRows = 0
strExist = Dir("Drivers.txt")
lFile = FreeFile
Open strExist For Input As #lFile
lRow = 0
Do While Not EOF(lFile)
Line Input #lFile, sline
If Not Len(Trim(sline)) = 0 Then
lRow = lRow + 1
vData = Split(sline, ",")
MSFlexGrid1.Rows = lRow
If (UBound(vData) + 1) > MSFlexGrid1.Cols Then
MSFlexGrid1.Cols = UBound(vData) + 1
End If
For lCol = 0 To UBound(vData)
MSFlexGrid1.TextMatrix(lRow - 1, lCol) = Trim(vData(lCol))
Next lCol
End If
Loop
Close #lFile
End Sub
Private Sub cmdUpDri_Click()
'code that write back to text file
Dim strExist As String
If MSFlexGrid1 = "" Then
MsgBox "One or More Cells Are Empty" & vbNewLine & "Please Ensure All Data Is Correct Before Saving!" & vbNewLine & "Please Set Default to Zero, If There is no Data to Enter", vbExclamation, "Empty Cells"
frmUpdate.SetFocus
Exit Sub
End If
Dim MyFreeFile As Integer
Dim reply As Integer
reply = MsgBox("Do you really wish to Update Drivers League?", vbYesNo + vbExclamation, "Confirm Update")
If reply = vbYes Then
MsgBox "Drivers League Update Completed Sucssefully!", vbInformation, "Update Complete"
Dim icol As Integer
Dim irow As Integer
Dim MyString As String
strExist = Dir("Drivers.txt")
MyFreeFile = FreeFile
Open strExist For Output As MyFreeFile
For irow = 0 To MSFlexGrid1.Rows - 1
For icol = 0 To MSFlexGrid1.Cols - 1
MyString = MyString & MSFlexGrid1.TextMatrix(irow, icol) & _
IIf((icol = MSFlexGrid1.Cols - 1), "", ",")
Next
Print #MyFreeFile, MyString
MyString = ""
Next
Close MyFreeFile
Else
If reply = vbNo Then
frmUpdate.SetFocus
End If
End If
End Sub
|
|
|
|
|
does anyone knows how to conect vb.net with postgre, but i wa\nna do it, by ado.net or ole.. thenks
|
|
|
|
|
|
I want to know that is there any way to scroll a text box by codes without using mouse or key board.
|
|
|
|
|
Hmm. If there is, they really ought to describe it in the documentation. Now there are hundreds of properties and methods. How about something that has "Scroll" in its name? Maybe even starts with "Scroll"?
Somebody will have to look it up.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
look it up? where in the world would one do that?
the guy at the public library didn't even know what visual basic was so where would one go from there? I'm so lost!
If only there were some way to search through all of the websites on the internet, or even just all of the articles on this site...
If only...!
|
|
|
|
|
Now your just going to far.......there is no technology in this world that can do that!
|
|
|
|
|
I once heard tell of a tale where this magical genie could answer all your questions by providing you "links" to different "sites" with vast amounts of writing in a strange language called "HTML". That writing would have all of the information you could possibly desire.
Sounded strange to me. "links"? like in a chain? "sites"? is that like it would magically take you to Abu Dhabi somehow using that chain? And "HTML" sounds like alien talk to me.
I wish I could find that genie. Apparently there were two of them...one named "Larry Page" and one named "Sergey Brin".
|
|
|
|