|
Christian Graus wrote: I thought new versions of Office also use .NET ?
That's only partially true. The object support is better, but it's still VBA under the hood, sadly.
|
|
|
|
|
2DaveMoon wrote: A veteran will know it
A veteran will have forgotten it - we all moved on 8-9 YEARS ago.
You are still making your life difficult by using VB6, you will get better support by going to VB.Net
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
2DaveMoon wrote: A veteran will know it.
Oh yeah?? This verteran forgot VB6 8 years ago.
I've read through this entire thread and can't figure out what you're doing with an Explorer window or why.
|
|
|
|
|
VB Programmer- novice
I would like user to enter data into 3 columns in datagridview. The object of the excercise is to add values entered by user into a dataset which further will be added to a database table after more processing of data.
The data sample is as follows:
1. account code- a combo box - values to be populated from accounts table( acct code, acct desc)
2. Entry narration- text entered by user
3. amount - amount for the transaction
I was able to populate datagridview with 1st record with combobox, text field and amount field. But do not know how to replicate combobox to next line. Can somebody provide me a sample code in vb2005 to do the same.
BM17
|
|
|
|
|
Wait. It sounds like you're putting a ComboBox control into the DataGridView yourself??
|
|
|
|
|
Yes, I want to control datagridview.as dataset with get populated from datagrid values.The combobox will get values from another database table.
|
|
|
|
|
That made no sense at all.
Normally, you would use a form, or some textbox's, ComboBox's, or other controls on a seperate area of the form to get data to use in the search for records, populating the DataGridView with the results. You wouldn't normally use a DataGridView to get the parameters of the search.
|
|
|
|
|
I need help to create a text box that accepts only numbers and full stop in VB.Net. It was easy in vb6 but in VB.Net I am really confused. Can someone help me please,
Thank you.
|
|
|
|
|
You need to handle the KeyPress Event[^] like you did with vb6. Reagrds: Didi
|
|
|
|
|
How about using NumericUpDown control?
(I guess you are allowing '.' for user to enter decimal numbers.)
जय हिंद
|
|
|
|
|
Private Sub txt1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txt1.KeyPress
Try
If Not (Char.IsNumber(e.KeyChar) Or Char.IsControl(e.KeyChar)) Then e.Handled = True
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
My advice is free, and you may get what you paid for.
|
|
|
|
|
Thank you very much Johan, Actually i wanted the box along with dots inbetween the numbers and I added IsPunctuation to your code. Thank you once again.
Didi, I was trying to do it as in vb6 but it was driving me mad without an answer. Ofcourse I am a beginer in VB.Net and Johan's coding is very new to me.
Danish, thanks for your reply but I needed a box with numeric values and with / without decimals to be keyed in.
Thank you all.

|
|
|
|
|
If you are used to VB6, you'll find .NET a bit confusing in the beginning, because its approach is just a little different, however just like in the example code I showed you, check out all the new properties and methods. Lots of things have become much easier to do, and I am quite sure you'll come to love it in about two weeks time, and wonder how you managed to do it all with vb6.
My advice is free, and you may get what you paid for.
|
|
|
|
|
The KeyPress code that you were given will work, just remember that if a user pastes a value into the textbox, the keypress code isn't going to stop the alpha characters like usual. It will still be possible for alpha values to get into the textbox, and you may have to add code to check for it. Just thought I'd mention it, since I've encountered that issue before.
|
|
|
|
|
Iam using the following for save
-------------------------------------------------------------------------------------
Dim DAD31 As SqlDataAdapter,DS31 As New DataSet,DTB31 As New DataTable
Dim Save_4 As String = "insert into itemmst (itm_description) values (&itm_description)"
DAD31.InsertCommand = New SqlCommand(Save_4, con)
con.Open()
Dim Trans As SqlTransaction
Trans = con.BeginTransaction
DAD31.InsertCommand.Transaction = Trans
Try
DAD31.Update(DS31.Tables(0))
Trans.Commit()
Catch ex As Exception
If Not Trans Is Nothing Then
Trans.Rollback()
End If
MsgBox(ex.Message)
End Try
con.Close()
----------------------------------------------------------------
Problem is if the
itm_description=BULB .........working nice....But if the
itm_description=COUPLING 54"x64" is not insering...because of this " and '
Better ideas are always welcome.!!!
|
|
|
|
|
It's always a bad idea to create SQL commands by manually appending strings, cause you will end up with this problem. Also, you will be vulnerable to SQL injection attacks.
In order to avoid that, you should build your command using parameters.
If you need further help with that, or some example, just let me know.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
Can You Post, sample codings?
THANK YOU 
|
|
|
|
|
If I undestand correctly what you are trying to do, an example could be:
Dim Save_4 As String = "insert into itemmst (itm_description) values (@itm_description)"
Dim com As SqlCommand = New SqlCommand(Save_4, con)
Dim par As SqlParameter = New SqlParameter("itm_description", SqlDbType.Text, 255, ParameterDirection.Input, False, 0, 0, "itm_description", DataRowVersion.Current, itm_description)
com.Parameters.Add(par)
con.Open()
Dim Trans As SqlTransaction
Trans = con.BeginTransaction
com.Transaction = Trans
Try
com.ExecuteNonQuery()
Trans.Commit()
Catch ex As Exception
If Not Trans Is Nothing Then
Trans.Rollback()
End If
MsgBox(ex.Message)
End Try
con.Close()
Please have a look at the documentation for the SqlParameter class, in order to apply the correct values to all parameters for your specific needs.
If you need to do something more complex, like for example reading the data into a dataset, binding it to some UI controls, modifying it and then applying the modifications to the DB, you can have a deeper look at the SqlDataAdapter class. It has methods to automatically build your select/insert/update/delete commands and managing modifications to your datasets. You can have a look at one of the many good articles about ADO.NET on the web.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
I want to emphasize the relationship of some adjacent Cell Rows in a Column, by Drawing a 2 or 3 Pixel Line around the Group of Cells.
I read that the Microsoft DataGridView Control does not support the Individual Cell Border Style in the Current Version.
Does anyone have a routine, or suggestions that will achieve this result with the MS DataGridView Control.
Thank you for your time to read this message.
Regards, Graham
|
|
|
|
|
You may need to handle the control's paint event and draw it on top of the control.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
Thank you.
And do you have some suggestions of how this could be done?
I'm just looking for some guidance here.
Regards, Graham
|
|
|
|
|
Why not set the backcolour of the highlighted cells to a slightly brighter colour! That you can do un=sing the oncellpaint event.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I'm using the BackColour Property for a different purpose.
Regards, Graham
|
|
|
|
|
My point still stands - if you are using red in the backcolour for highlighting a row then the cells in the block you want to highlight in that row get a slightly brighter red, the green row gets a brighter green. It may be better than having to manage the complete cell redraw to get a cell border.
Also you may want to look at Infragistics tools, one of my major complaints about their tools are the number of properties you can set on them, this may be a good thing for you.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks. I'll consider your suggestion for Plan B.
For now I'll keep looking and working on Plan A. It is more appropriate in the overall design.
Regards, Graham
|
|
|
|