|
I suggest you to use the DatagridViewComboboxColumn and DatagridViewTextBoxColumn into a DatagridView.
You should google a little and focus on what you need. For other problem during your development, you will be able to post specific problems and we will help you.
Shay Noy
|
|
|
|
|
I have done something like that with data bound items. You select combobox in Form design view and then click on the sign in the upper right corner of combobox picture. There you select checkbox use bound items and then select apropriate data source, value member and, data member. If you have stored pricess of separate model types in a different table, you will have to make relations between tables to work properly.
|
|
|
|
|
Hi,
I have a datagridviewcomboboxcolumn and I would like to change the selectionbackcolor.
I success in part:
I change the selectionbackcolor to cyan but when I am selecting other item the backcolor of the previous stll cyan
Here is a snippet of my code:
Private Sub EditingControlCombobox_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs)
If e.Index = -1 Then Exit Sub
e.DrawBackground()
Dim brsh As SolidBrush, Fnt As Font
Dim backBrush As SolidBrush
If CType(sender, DataGridViewComboBoxEditingControl).SelectedIndex = e.Index Then
backBrush = New SolidBrush(Color.Cyan)
Else
backBrush = New SolidBrush(Color.Empty)
End If
If e.Index = 0 Then
brsh = New SolidBrush(Color.Purple)
Fnt = New Font("Times New Roman", 10, FontStyle.Italic)
Else
brsh = New SolidBrush(Color.Black)
Fnt = EditingControlCombobox.Font
End If
e.Graphics.FillRectangle(backBrush, e.Bounds)
backBrush.Dispose()
e.Graphics.DrawString(NegotiationItemList.Items(e.Index).ToString, Fnt, brsh, e.Bounds)
brsh.Dispose()
End Sub
Thank you
Shay Noy
|
|
|
|
|
I guessing that you have not put the color changing code in your selectedIndexChanged event. Because you have to select a different index before you can edit, I'd put my code there to change the color back to what you want.
Just because we can; does not mean we should.
|
|
|
|
|
Sorry, I don't understand what you mean.
Shay Noy
|
|
|
|
|
hi all
i have created a stored procedure in sql server with two parameters
todate and from date
i want to generate a crystal report using above procedure
i have no idea about what to write in add command of report for
executing a stored procedure with parameters
if anyone have any idea pls suggest
|
|
|
|
|
Look around on google for examples
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Hi,
I hav a code for import data from excel to sql server. This code used to import data totally. That is, already some data in excel imported the whole data to sql server.The code is,
Dim excelConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Book1.xls;Extended Properties=""Excel 8.0;HDR=YES;"""
Dim connection As OleDbConnection = New OleDbConnection(excelConnectionString)
Try
Dim command As OleDbCommand = New OleDbCommand("Select ID,Data FROM [Sheet1$]", connection)
connection.Open()
Dim dr As OleDbDataReader = command.ExecuteReader
Try
Dim sqlConnectionString As String
'= WebConfigurationManager.ConnectionStrings("CampaignEnterpriseConnectionString").ConnectionString
sqlConnectionString = "Data Source=rafik-vzi7iicz1\sa;Initial Catalog=Excel;Integrated Security=True"
Dim con As SqlConnection
con = New SqlConnection(sqlConnectionString)
Dim bulkCopy As SqlBulkCopy = New SqlBulkCopy(sqlConnectionString)
Try
bulkCopy.DestinationTableName = "Exceldata"
bulkCopy.WriteToServer(dr)
Finally
CType(bulkCopy, IDisposable).Dispose()
End Try
Finally
CType(dr, IDisposable).Dispose()
End Try
Catch ex As Exception
Finally
CType(connection, IDisposable).Dispose()
End Try
MsgBox("imported successfully", MsgBoxStyle.Information)
The code is working perfectly.
My problem is, i need to import the data by character wise. That is, suppose i typing some word in excel, the word automatically saved in sql server by character wise.
Any idea Plz tell me.
Suggestions also appreciate.
Plz help me.
|
|
|
|
|
kamarudeen wrote: i need to import the data by character wise.
What do you mean by "character wise"??
|
|
|
|
|
character wise means cell by cell. That is the data imported to sql server cell by cell.
For ex:
excel sheet:
CELL 1 CELL 2 CELL 3 CELL 4
DATA: VELU RAMU RAMU KATHER
KAMAR SIDDIQ SADIQ SEERR
this is sample data. I need to import data every cell by cell.
|
|
|
|
|
hello
I want to know why this error "Exception of type 'System.Windows.Forms.AxHost+InvalidActiveXStateException'.
now i'm tracing why this error occurr, but can't find yet.
if someone has experience with this error, please help me and send me message.
phoopwint
flowerppk
|
|
|
|
|
AxHost is a class that hosts ActiveX (COM) components on your form. You have a COM-based control that you added to your form that is misbehaving.
|
|
|
|
|
Dear programmers,
Can anyone give me the code to make the data displayed in the datagrid or HFlexGrid editable and then save that in the database.
I urgently need that for my project in the job.
Thanks one and all
Keshav Singh Developer in C++ and VB
|
|
|
|
|
Keshav Singh Sunwar wrote: urgently
Very impolite.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi Paul,
Keshav here to whom you replied a few hours back. I m extremely sorry for the words I used in my message.
Actually I need to do the same at any cost before this weekend, that was the reason 4 the message.
I am trying to make datagrid editable by inserting a textbox on the click event of the Flexgrid for each cell clicked.
I hope it will work out.
Thnx for the message
keshav
Keshav Singh Developer in C++ and VB
|
|
|
|
|
I think Dave's reply is the better one
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
This[^] is about the best information you're going to get on creating an editable MSFlexGrid.
|
|
|
|
|
I am using VB 2005. trying to create wilcard parameter search. I don't know how to connect variamble Name to the one using in SQL statements.
SQL lines in Query builder:
SELECT ID, Ime, Priimek, [Službeni telefon], [Službeni GSM], [Domaci telefon], [Privatni GSM], [Elektronska pošta], [Domaci naslov]<br />
FROM SLUŽBA<br />
WHERE (Priimek LIKE '%' & '@NAME' & '%')
And in Form2 I have this code inside button1 object:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
<br />
Dim NAME As String<br />
<br />
NAME = TextBox1.Text<br />
<br />
<br />
Try<br />
Me.SLUŽBATableAdapter.FillBy2(Me.TelefonskiImenikDataSet.SLUŽBA, NAME)<br />
Catch ex As System.Exception<br />
System.Windows.Forms.MessageBox.Show(ex.Message)<br />
End Try<br />
End Sub
can anyone tell me what is wrong here and correct the code, please.I've b een researching a lot and don't find a proper solution. Please Help. The builder doesn't report any error but the button doesn't do a query parameter wildcard search. Variable NAME is underlined with green waveline.It says too many arguments to function FillBy2.
|
|
|
|
|
BOREC wrote: '@NAME'
Remove the apostrophes around the parameter. The apostrophes tell SQL Server to expect a string literal value.
|
|
|
|
|
Could it be that wildcard parameter search doesn't work because I use Express edition version of the program?
When I remove the apostrophes the wizard alerts: Erros in WHERE clause near '@'. Unable to parse query text.
I tried a lot ways to create a FillBy2 function with apropriate SQL statements and then call the function in Button_click subroutine but it doesn't work. Has anyone done this at home or office?
Can someone post the whole code so I can analyze it. Comments very welcome.
Bye
|
|
|
|
|
You can pad the value entered by user with '%' before sending it as parameter, ie
1. User type in 'abc'
2. In your code, pad the value to '%abc%'
3. Set the padded value to the parameter.
So your selection will just be:
WHERE (Priimek LIKE @NAME)
By the way, your original selection statement always search for '%@NAME%' <-- no longer a parameter.
|
|
|
|
|
I understand this. But what puzzles me is that when I create parameter search using this SQL statement
SELECT...
FROM ...
WHERE ( Priimek = ?) the wizard automaticaly creates a function FillBy
the wizard automaticaly creates a function FillBy(Priimek) With a variable Priimek which I can use in this statement
Me.SLUŽBATableAdapter.FillBy2(Me.TelefonskiImenikDataSet.SLUŽBA, PriimekToolStripTextBox.Text)
But when I create a function with SQL statement
WHERE (Priimek LIKE @NAME)
I get a function with no parameter. The wizard simply puts it out as FillBy2()<-no parameter.
I want to create a parametrized wildcard search. When I write "Klaj" out of "Klajnšek" Lastname in TextBox1 I want that the program displays all records with letters "klaj" in LastName like "Klajnšek" or like "Priklajdorin". I hope you understand.
Thank you for help
modified on Thursday, December 27, 2007 7:55:50 AM
|
|
|
|
|
BOREC wrote: Could it be that wildcard parameter search doesn't work because I use Express edition version of the program?
No. Parameters are such a basic feature that the Express edition includes it.
BOREC wrote: When I remove the apostrophes the wizard alerts: Erros in WHERE clause near '@'. Unable to parse query text.
Wizards!?! Why aren't you writing the code yourself. Wizards won't help you, they hinder you because they only allow limited functionality and produce inefficient code (they do produce correct code though which is their primary aim)
|
|
|
|
|
I would need a good example code to do that, otherwise I can't do it. I am not that good.
|
|
|
|
|
If no one has mentioned to this you before, please give your message titles meaning.
|
|
|
|