|
I have a class for MyDataGridView - To control the Enter Key , the below is working fine. But I canot focus to particular row for repeated values.
Actually if the user enters the repeated value, then the control has to move to that particular cell.
-------------------------------------------------
Public Class MyDataGrid
Inherits DataGridView
Protected Overloads Overrides Function ProcessDialogKey(ByVal keyData As Keys) As Boolean
If keyData = Keys.Enter Then
Dim col As Integer = Me.CurrentCell.ColumnIndex
Dim row As Integer = Me.CurrentCell.RowIndex
If Not (row = Me.NewRowIndex) Then
If col = (Me.Columns.Count - 1) Then
col = -1
row += 1
End If
Me.CurrentCell = Me(col + 1, row)
End If
Return True
End If
Return MyBase.ProcessDialogKey(keyData)
End Function
Protected Overloads Overrides Sub OnKeyDown(ByVal e As KeyEventArgs)
If e.KeyData = Keys.Enter Then
Dim col As Integer = Me.CurrentCell.ColumnIndex
Dim row As Integer = Me.CurrentCell.RowIndex
If Not (row = Me.NewRowIndex) Then
If col = (Me.Columns.Count - 1) Then
col = -1
row += 1
End If
Me.CurrentCell = Me(col + 1, row)
End If
e.Handled = True
End If
MyBase.OnKeyDown(e)
End Sub
End Class
----------------------------------------------
with my form
Private Sub MyDataGrid1_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles MyDataGrid1.CellEndEdit
If MyDataGrid1.CurrentCell.ColumnIndex = 0 Then
Dim RwNum As Integer = 0
Dim ep_id As String = Space(10)
ep_id = MyDataGrid1.CurrentCell.Value
RwNum = dbndf_52.Find("emp_id", ep_id)
If RwNum > 0 Then
MyDataGrid1.CurrentCell = MyDataGrid1(0, RwNum)
End If
End If
End sub
It's moving to that new row but again, retun to the previous row and moving to next column. This is my problem.
Anybody can help me to repair it?
Thanks
|
|
|
|
|
Paramu1973 wrote: Actually if the user enters the repeated value, then the control has to move to that particular cell.
Why?? This sounds like a user interface nightmare.
|
|
|
|
|
Hi Dave,
Thanks For Your Comments. From that particular table, field Emp_ID is not a primary key field.
So there is possible to re-enter the same emp_id.Once the user re-enter the emp_id, then we need to focus the
particular emp_id cell.
Is It Possible To Focus To The Different Cell?
Thanks Again
|
|
|
|
|
The users should not be generating their own record keys. That should be left up to the database. I would recommend that you look for duplicate data in the database at the time it's entered, not at the time it's trying to commit to the database.
|
|
|
|
|
Why would you put the focus on an existing ID?? That would just set you up for the user destroying data already existant in the database.
IMHO, users should not be using the DataGridView for entering data. It should be done using a dedicated form or control, seperate from existing data.
|
|
|
|
|
Hi,
Thanks for the kind advice, But as per my opinion, users are interested in Datagridview method. Because, they are able to see their previous entries as like Excel.
And by the way I solved by focusing from Datagirdview editing Control Showing -Keydown. But it took my one-day.
Thanks For Your Kind Reply !!!!
|
|
|
|
|
Hi all,
i am a student from Hong Kong who only know a little bit VB.
i have some questions about Visual Basic 2008.
1. how to import a excel/csv file to axspreadsheet/DataGridView?
2. how to convert csv to dbf/mdf from axspreadsheet/DataGridView? (the csv file is huge , it cannot open from excel directly.)
3. how to compare two DataGridView and output the result to a new DataGridView.
4. how to make a filter function for DataGridview ( function like AutoFilter in the excel)
Anyone can help me ? or suggest a book/reference to me for those question?
Thank you very much.
|
|
|
|
|
If you "only know a little VB", you're going to find this project impossible. Some of your questions require that you know how to do database operations in VB.NET, along with a decent knowledge of the .NET Framework.
1. Google: "VB.NET import csv file"[^]
2. See #1. You're reading a CSV file line by line, parsing it, then putting the data into a database INSERT query and executing it. Google for "vb.net insert data to Access database[^]".
3. You're not comparing to DataGridViews. DataGridViews would be bound to DataTable objects and showing the data in those objects. You either compare the two DataTable objects, row by row, field by field (this will take a while!), or you have the database do it for you somehow. Exacty how you do this depends on the data and the comparison you want, and what the result your looking for should be.
4. You'll need to look into the DataTable and DataView classes. There is a Filter property that will let you do this.
|
|
|
|
|
Thanks for your reply.
I know it is hard to do this for me. However, i will try my best to finish it.
I decided to find a book and study by Chapter 1.
|
|
|
|
|
coolqer wrote: I decided to find a book and study by Chapter 1.
Fantasic idea! You'd be surprise how many people don't want to learn the basics before trying to write something like an enterprise-class accounting package.
|
|
|
|
|
a book is an excellent idea and there are plenty of articles [^]available for learning as well
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thank you very much~
although it is C#,it still a great simple for me.
|
|
|
|
|
Hello, i am trying to make a POST to my router, i have literaly turned google upside down but to no avail.:S Does anyone give me some help? thankyou
i have the following information:
<b><u>POST</u></b>
http://192.168.1.1:8080/status/editppp.html/PppoE
Request Header
<br />
Host: 192.168.1.1:8080<br />
Authorization: Basic YWp1ZGFtZSE=<br />
Referer: http:
Content-Length: 151
Request Body
EmWeb_ns%3Avim%3A3=%2Fstatus%2Feditppp.html&EmWeb_ns%3Avim%3A8.ImServices.ppp-0.1%3Aenabled=false&EmWeb_ns%3Avim%3A4=ImServices.ppp-0.1.ImChannels.item0
|
|
|
|
|
I have no idea what you're trying to do with this. About all I can suggest would be to look into the WebRequest and HttpRequest classes, along with their Response counterparts and see if they would fill your needs, whatever those are.
|
|
|
|
|
How can I create a window like Windows 7 uses for the wireless networ connect? In Vista it has a glass border but isn't resizable and has no caption. I tried manually setting the style but it always stays resizable...
I can't use spy++ to see the style it uses because it disappears when it loses focus.
http://i258.photobucket.com/albums/hh243/omnicoder/dlg.png[^]
Have you tried the Krypton Toolkit? http://www.componentfactory.com/free-windows-forms-controls.php
|
|
|
|
|
This will not be easy.
You first have to make your form, borderless and no title bar, larger than the visible window you want to show. The form should be the same size as the visible window plus the border. You're also going to have to handle events and mouse clicks to make your "simluated" window respond the same as a normal window.
The Glass concept is pretty straight forward. Grab a snapshot of the screen, then use that to calculate the "smear" you see in the glass border, painting that image to a bitmap the size around your window, with the thickness you want. Then draw the border and then the visible window just inside the border. Done!
In concept, it's pretty easy. In practice, you'll be in for a nasty fight to get it to work properly.
And, no, I don't know of any examples...
|
|
|
|
|
Greetings,
I was given the following task and I need some expert advice.
Excuse me if I get terms wrong.
I was given 2 files from our plant in Mexico. a .cer and a .key file.
On an Invoice, we have to put a string of information that is basically the invoice details.
We then take that string, and turn it into an MD5 Hash code.
Then we take that code and using the files that we were given, create another 'RSA' code that goes on the invoice also.
It is my understanding that the government issued the .cer and .key file and this is a way to prevent fraud.
I have figured out how to make the MD5 code. I am having difficulties with using the other 2 files to make the RSA string.
If anyone could help me out with some code examples for the RSA part, that would be great.
I know it has to use the string returned by the MD5 function, and also It would need to somehow use those .cer and .key files that were given to me.
That last part seems to be where I am stuck.. I cant seem to figure out how to use the .cer and .key files that were given to me, to encrypt some text.
|
|
|
|
|
Hi Im having the same problem, did you resolved?, can you help me?
|
|
|
|
|
I ended up purchasing a 3rd party software called Cryptosys to do this.
|
|
|
|
|
hello
i am using SQL server 2005 as my back end
now i want report of like from this date to this date...for that i wrote query like
format of my date is dd/MMM/yyyy
If optn1.Checked = True Or optn3.Checked = True Then
sqlstr="select * from des_mast"
sqlstr = sqlstr & "where pickup_date between '" & Me.dtp1.Value & "' and '" & Me.dtp2.Value & "'"
End If
but while executing this query shows an error message like
"incorrect syntax near the keyword 'between'"
please suggest i cant get where the problem is
thank you
|
|
|
|
|
Try formatting the date to mm/dd/yyyy.
If that really is your code your sqlstr looks like this "Select from des_mastwhere pickup_date..."
TonyMac
|
|
|
|
|
Change this SQL statement to a parameterized query, then you won't have to worry about the format of the date values coming from the controls. It'll be handled for you and will also prevent some injection attacks in your code.
|
|
|
|
|
I want to come up with a program for a security guard in a company. the task of the guard is to write:
-Visitors name
-time in
-time out
-purpose of visting
-who you are visiting
-and produce a report of all visitors of the day.
My questions are:
- VB6 is it web based
- I want a general idea about how the interface will look like.Thank you
|
|
|
|
|
Are... are you trying to hire me...?
My cost is 75$ per hour and flat 1500$ for the project..
I wouldn't use VB6, I like languages that are still supported.
|
|
|
|
|
Seriously, get VB.net, it is free and supported and there is more help available from CP than you will get with VB6.
As for the interface, given it is for security guards, Keep it simple!
My pref would be
One button to say NEW VISITOR IN, this would open a form for the information to be entered in.
One button to log them out, this would show the list of those signed in, and you would select the person leaving.
Once signed out that information would be held in an archive file.
This would be useful in emergencies like a fire for example, as everybody would be running out, so those that had not signed out could be accounted for.
------------------------------------
"Possessions make you poor, wealth is measurable only in experience."
Sun Tzu 621BC
|
|
|
|