|
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".
|
|
|
|
|
I used to use scrolls. Maybe there are some left around the Dead Sea.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
I find those oriental scrolls hard to understand. I prefer local ones.
the bars are somewhat better, but there too I prefer the local ones.
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).
|
|
|
|
|
there certainly is a way to do that.
See here[^].
|
|
|
|
|
Hey all!
I'm looking for a code, that add the TextBox' multiple strings into listview items, and subitems.
I got an form with an ListView and 2 columns. 2 textboxes, one for Name and one for E-mail. What i wan't is that if i e.g. type following in:
TEXTBOX1 | TEXTBOX2
Peter | mail@forclient.blabla
Anothername | anothermail@anotherclient.blabla
then it should add 2 items, with 1 subitem each. Under column 'Name' i wan't the textbox1 texts and the 'Email' column, i wan't the textbox2 texts
Hope you understand, i have searched on the entire internet, but no one, not even a little is heading to that. Hope you can help me.
|
|
|
|
|
<div class="signature">Dave
Don<br>Find Me On: <a href="http://www.dave-auld.net/" target="_blank">Web</a>|<a href="http://www.facebook.com/dave.m.auld/" target="_blank">Facebook</a>|<a href="http://www.twitter.com/daveauld/" target="_blank">Twitter</a>|<a href="http://www.linkedin.com/in/daveauld" target="_blank">LinkedIn</a><br>Waving? dave.m.auld[at]googlewave.com<br><br></div>
|
|
|
|
|
I am assuming that you are using a multi-line TextBox. If that's the case, then you could first split the TextBox1.Text value using the vbNewLine as the character to split on.
This will give you an array with an item for each line.
Dim nameLines() As String = TextBox1.Text.Split(New Char() {vbNewLine})
Dim emailLines() As String = TextBox2.Text.Split(New Char() {vbNewLine})
If nameLines.Count <> emailLines.Count Then
MessageBox.Show("Number of entries don't match")
Return
End If
For i = 0 to UBound(nameLines)
Dim newItem As New ListViewItem(New String() {nameLines(i), emailLines(i)})
ListView1.Items.Add(newItem)
Next
|
|
|
|
|
hmm. if vbNewLine is more than one character, the split will result in lots of fictitious empty lines.
use TextBoxBase.Lines instead.
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).
|
|
|
|
|
All:
I have an .net 1.1 framework application I would like to update to 3.0 framework (or at least 2.0), but I've just run into a real problem. The savefile dialog code which works fine in 1.1 does not work in 2.0 and up. Line for line the code is the same (there is no difference in line numbers at all). I'm baffled.
With the exception of throwing an error for the Quicktime 7 control, VS2008 indicated no errors in converting 1.1
I open my 1.1 (VS 2003) version and step through line-by-line. Works as advertised.
I open my 2.0 (VS 2008) version and step through line-by-line. Appears to be working, dialog opens fine, I enter a filename, code continues; but when complete, there is no file in the folder.
In VS2008 I'm compiling for x86 CPU to eliminate the Quicktime exception.
Any suggestions where I can start looking?
TIA for any help.
Norm
|
|
|
|
|
maybe start by posting your code you are using for using the savefiledialog.
from there we might be able to help.
|
|
|
|
|
All:
On further review the problem may be in a block of code to write a small XML file.
Here's a test block ....
This works fine in 1.1, but not 2.0
Imports System.IO
Public Class Form1
Private fn As String
Private projectFile As String
Private shortName As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
sfd.InitialDirectory = Environment.SpecialFolder.Personal
sfd.Filter = "Enscription Project (*.vpt)|*.vpt"
sfd.Title = "Trying to fix problem"
If sfd.ShowDialog = Windows.Forms.DialogResult.OK Then
fn = sfd.FileName
shortName = Path.GetFileNameWithoutExtension(fn)
projectFile = shortName
WriteXML()
Else
Exit Sub
End If
End Sub
Private Sub WriteXML()
Dim writer As New Xml.XmlTextWriter(projectFile, Nothing)
writer.WriteStartDocument(True)
writer.Formatting = Xml.Formatting.Indented
writer.WriteComment("Created using Enkadia Enscription - copyright 2010")
writer.WriteStartElement("EnkadiaEnscription")
writer.WriteStartElement("Project")
writer.WriteElementString("Transcription", fn & ".vtn")
writer.WriteElementString("EditorsNotes", fn & ".ved")
writer.WriteElementString("VideoClip", fn & ".mp4")
writer.WriteEndElement()
writer.WriteEndElement()
writer.Flush()
writer.Close()
End Sub
End Class
Again, thanks for any help.
Norm
|
|
|
|
|
two comments:
1.
you set an initial directory for the SFD, however you only store a short file name, so whatever path you are looking at, it does not get stored. Your new file will end up in the "current directory", which normally defaults to your EXE's folder. Go look inside ...\bin\debug.
BTW: this has not changed since .NET 1.0 so if the app's behavior has changed, then you did modify something that is relevant to your issue.
2.
there is a note in the XmlTextWriter Constructor documentation advising you not to use it that way.
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).
|
|
|
|