|
..that can only be accessed with a 'very long finger' method?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
hi
how i can display image in thumbnail mode in datagridview
|
|
|
|
|
please help me
<< never believe a lie >>
|
|
|
|
|
You need to size the image before displaying it, there is no facilty to resize in the grid as far as I know.
Member 2645365 wrote: please help me
You could to try help yourself - try Google!
Bob
Ashfield Consultants Ltd
|
|
|
|
|
hi
how i can resize image and save in sql server ?
tanks
|
|
|
|
|
Create a new bitmap
Bitmap bmpResized = new Bitmap(width, height);
and draw the original bitmap in the new created bitmap
Graphics grph = Grphics.FromImage(bmpResized);
grph.DrawImage(...)
|
|
|
|
|
Eduard already answered for resize image.
so for save an image in SQL server, first convert the image into byte array and then store in database field which is image type. Follow following steps
1. first of all i assume PictureBox1 hold the picture data. So use following statement
Dim PictureBox1Data As Byte()<br />
If PictureBox1.Image Is Nothing Then<br />
PictureBox1Data = Nothing<br />
Else<br />
PictureBox1Data = imageToByteArray(PictureBox1.Image)'See below this function<br />
End If
2.Now write the SQL query as following
Dim QueryText As String<br />
Dim QueryValue As String<br />
Dim command As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand()<br />
QueryText = "INSERT INTO Settings(PrintCompany,IsUploadLogo,LogoGraphic )"<br />
QueryValue = "Values(@PrintCompany, @IsUploadLogo,@LogoGraphic)"<br />
command.CommandText = QueryText & QueryValue
3. Supply Value to parameter which is in above query, as following
command.Parameters.Add("@PrintCompany", SqlDbType.TinyInt, 10).Value = True<br />
command.Parameters.Add("@IsUploadLogo", SqlDbType.TinyInt, 10).Value =True<br />
If Not PictureBox1Data Is Nothing Then<br />
command.Parameters.Add("@LogoGraphic", SqlDbType.Image, PictureBox1Data.Length).Value = PictureBox1Data<br />
Else<br />
command.Parameters.Add("@LogoGraphic", SqlDbType.Image, 0).Value = System.DBNull.Value<br />
End If
4. Execute query as following
command.ExecuteNonQuery()
step 1 to 4 read data of picture box,convert them byte array and store in related table.Step 1 use following function to convert an image into byte array
Public Function imageToByteArray(ByVal ImageIn As System.Drawing.Image) As Byte()<br />
Dim ms As MemoryStream = New MemoryStream()<br />
Dim FormatImage1 As Imaging.ImageFormat = ImageIn.RawFormat<br />
ImageIn.Save(ms, FormatImage1)<br />
'ImageIn.Save(ms, Imaging.ImageFormat.Bmp)<br />
Return ms.ToArray()<br />
End Function
hope this helps
|
|
|
|
|
tank Rupesh Kumar Swami.
but , your code save image in database only. don 't resize it.
<< never believe a lie >>
|
|
|
|
|
Member 2645365 wrote: tank Rupesh Kumar Swami.
"Thanks" Rupesh.
Member 2645365 wrote: your code save image in database only. don 't resize it.
That's the code I needed to save the image to the database! I have tried it, and it doesn't resize the image. I will try to code this myself.
|
|
|
|
|
hi
differnce betwen Me.Close() and Me.Dispose() in vb.net
i used Me.close() to close the current Form in Windows application
and the same thing i done by using Me.Dispose()
it is also giving the same result
Then what is the differnce
thanks in advance
vijay kumar d
|
|
|
|
|
Hii
Functionality of Me.Close or Me.Dispose is same. but when you use the objects of the forms like
dim myForm as New frmWelcome
and when you use myform.close and then myform.show it shows old data on form but we you myform.dispose then myform.show it shows fresh form.
may it clears your confusion.
Thanx
Mitesh Khatri
~Khatri Mitesh
khatrimitesh@hotmail.com
Bikaner (Rajasthan)
INDIA
|
|
|
|
|
~Khatri Mitesh~ wrote: when you use myform.close and then myform.show it shows old data on form but we you myform.dispose then myform.show it shows fresh form.
That is wrong. When you do that, it throws ObjectDisposedException .
|
|
|
|
|
Both are same. Both disposes the form and releases all unmanaged resources. The difference is only in semantic.
|
|
|
|
|
Dialogs (forms displayed with ShowDialog()) are just closed by Close(). You must use Dispose() to dispose the resources used by the dialog (unless you want to show that dialog instance again later).
For non-dialogs (forms displayed with Show()), Close() does the same as Dispose().
|
|
|
|
|
Hi all,
I have a WebServices. I want to pass Instance of OracleConnection to Client because i don't want initialize a OracleConnection at Client for Security. But I known OracleConnection Object build-in .Net without implement IxmlSerializable, in others words OracleConnection don't have ability Serializable.
Pls, help me. Give me introduction or some guide to pass Instance of OracleConnection to Client from Webservices.
Thank alot
Best Regard
Luc
|
|
|
|
|
lucdt wrote: I have a WebServices. I want to pass Instance of OracleConnection to Client because i don't want initialize a OracleConnection at Client for Security
You can't do that. The Oracle connection object is not serializable. All database operations should be handled by the WebService, not the client. The client and webservice should pass the data back and forth, not database objects like connections, dataadapters, commandbuilders, ...
|
|
|
|
|
Thank for quick reply !
I will chance my design.
Bests regards
|
|
|
|
|
You cannot do this and even if you could there's no point.
Separate your application logic to at least 4 different layers:
- database
- data access layer (the only layer that has to use OracleConnection)
- business logic layer
- UI layer
The layers communicate only with the layer above or underneath so the UI layer does not communicate with DAL and certainly not with the database.
There are several good walkthroughs and articles about this in the internet.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Thank for quick reply !
I will chance my design.
Bests regards
|
|
|
|
|
If ds.HasChanges Then
ds = New DataSet("Database")
Dim dsChanges As DataSet = ds.GetChanges()
Dim updateSQL As String = ("UPDATE CourseLearningOutcomeAssignment SET CoverageExtentID = ? WHERE LearningOutcomeID = ? AND CourseID =?")
da = New OleDbDataAdapter
Dim updateCmd As New OleDbCommand
updateCmd.Parameters.Add("CoverageExtentID", OleDbType.VarChar)
updateCmd.Parameters.Add("LearningOutcomeID", OleDbType.Integer)
updateCmd.Parameters.Add("CourseID", OleDbType.Integer)
updateCmd.Parameters("CoverageExtentID").Value = 2
updateCmd.Parameters("LearningOutcomeID").Value = 1
updateCmd.Parameters.Add("CourseID", OleDbType.Integer)
updateCmd.Parameters("CoverageExtentID").SourceColumn = "CoverageExtentID"
updateCmd.Parameters("LearningOutcomeID").SourceColumn = "LearningOutcomeID"
updateCmd.Parameters("CourseID").SourceVersion = DataRowVersion.Original
myConnection.Open()
da.Fill(ds, "viewcoursedata") <----- stops at this line of code.... with the error msg "The SelectCommand property has not been initialized before calling 'Fill"
DataGridView2.DataSource = ds.Tables("viewcoursedata")
da.Update(dsChanges, "viewcoursedata")
ds.AcceptChanges()
If updateCmd.ExecuteNonQuery() Then
MsgBox("Updated Successfully")
Else
MsgBox("Not updated Successfully")
End If
myConnection.Close()
The problem is when we try to update the datagrid with information weve entered it doesnt send it to the database, then it has an error at the line above.
Any help would be great! project due tonight!
|
|
|
|
|
Where to begin...
First you appear to be mixing up two completely different approaches to updating a database.
Second, you are using a dataset object, which contains ready methods for select, insert and update, and then you try to create the update statement by hand, run it through a OleDbCommand, which you then not connect to the data adapter, which you then expect to execute the OleDbCommand, by calling its fill method, which executes the select statement.
Third, you check whether your dataset has changes and then, when it does, you empty it by assigning it to a new empty dataset.
Fourth, etc, etc, etc.
So, not to leave you hanging, try to go through the following steps and rewrite your code:
1. when you created the OleDataAdapter, you supposedly wrote some select statement.
2. when you finished creating the OleDataAdapter the designer should have created the necessary update and insert statements for you.
3. you created a dataset and bound it to the OleDataAdapter.
4. you probably have a button or something that will execute OleDataAdapter1.Fill(DataSet1, "TableName"). This executes the select statement
5. your datagrid shows the contents of the dataset because you bound it to the dataset.
6. the user makes changes in the datagrid. The dataset bound to the datagrid records the changes (automatically).
7. you probably have a button or something that will execute the code you posted.
8. Completely forget your code. Writing entirely new code will be easier than correcting this mess.
9. use
OleDataAdapter1.Update(DataSet1) instead.
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hi
I was just wondering if anyone can help me with my question. i just started vb about a month ago and i'm trying validate data that is being input into a textbox in my calculator. i only want numbers and nothing else. But i can't figure out the parameters that i'm suppose to set for check if the input is valid or.
thank you
|
|
|
|
|
try following
Private Sub textbox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles textbox1.KeyPress, txtFuelCostPerGallon.KeyPress<br />
If Not (Char.IsControl(e.KeyChar) Or Char.IsNumber(e.KeyChar)) Then<br />
e.Handled = True<br />
End If<br />
End Sub
hope this helps
|
|
|
|
|
The answer given previously is working, but an alternative could be to use MaskedTextBox and to define the Mask property.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
hi
Dave Kreskowiak, the below coding didnot work, i am using sql server 2000 with vb.net 2003 is that the resaon?
TextBox2.Text = String.Format("{0} {1}", dr.columnName.Value, dr.columnName.Value) ??
i am using an instance of the class Dataset2.CASHIER_INFORow(dim dr As Dataset2.CASHIER_INFORow)
kewyn
|
|
|
|