san galing ang image? sa computer mismo or sa database?
sa computer po mismo sir ... hirap po kc d aq makakita sa goolge puro c# help me po .
Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.
All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!
san galing ang image? sa computer mismo or sa database?
sa computer po mismo sir ... hirap po kc d aq makakita sa goolge puro c# help me po .
Imports System.Windows.Forms
Imports System.Drawing
Imports System.IO
Private Const INT_h As Integer = 170 ' resize to desired thumbnail size
Private Sub btnBrowse_Click(sender As Object, e As EventArgs) Handles btnBrowse.Click
Dim OpenFile As New OpenFileDialog
Dim result As DialogResult
Dim File As String
Dim w As Integer = INT_h
Dim h As Integer = INT_h
Try
With OpenFile
.Filter = "JPG|*.jpg|JPEG|*.jpeg|BMP|*.bmp|PNG|*.png|ALL|*.*"
.Multiselect = True
.Title = "Image Upload"
result = .ShowDialog()
End With
If result = Windows.Forms.DialogResult.OK Then
Dim myBitmapSmall As Bitmap
For Each File In OpenFile.FileNames
Dim myControl As New ucPictureBox ' this user control has a picturebox (pb), a textbox (txt), 2 buttons (btnClose and btnPreview)
myBitmapSmall = New Bitmap(w, h)
Using g As Graphics = Graphics.FromImage(myBitmapSmall)
g.DrawImage(New Bitmap(File), 0, 0, w, h)
End Using
With myControl
.ImageLocation = File
.pb.Image = myBitmapSmall
.txt.Text = Path.GetFileNameWithoutExtension(File)
.ImageExt = Path.GetExtension(File)
.ImageId = 0 ' under sa ucPictureBox, mag declare ka ng ImageId
End With
FlowLayoutPanel1.Controls.Add(myControl) ' may flowlayoutpanel sa form, para e dagdag nya ang control (ucPictureBox) sa form.
System.Threading.Thread.Sleep(200)
Next
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
dim num as integer
int32.tryparse(cmd.executescalar, num)
TS! ginawa ko na yung pinost mo na code, ganun pa din error eh!
Paano po yung way niyo para masave sa database yung primary key(id) ng isang row kung ang makukuha niyong value e ung other column?
example:
student id | student name | age |
1 Yaki Udon 48
Ang nasa combo box ko e ung list of student names na pag sesave ko sa database, ikequery ko muna yung student name sa dataset para makuha ung student id at isave sa database. Ano po bang best way para mapadali to? Help please. Thanks.
here's a sample code, this will resize the image to a thumbnail, nasa button browse ang code na to (gawa ka nalang ng button)
Code:Imports System.Windows.Forms Imports System.Drawing Imports System.IO Private Const INT_h As Integer = 170 ' resize to desired thumbnail size Private Sub btnBrowse_Click(sender As Object, e As EventArgs) Handles btnBrowse.Click Dim OpenFile As New OpenFileDialog Dim result As DialogResult Dim File As String Dim w As Integer = INT_h Dim h As Integer = INT_h Try With OpenFile .Filter = "JPG|*.jpg|JPEG|*.jpeg|BMP|*.bmp|PNG|*.png|ALL|*.*" .Multiselect = True .Title = "Image Upload" result = .ShowDialog() End With If result = Windows.Forms.DialogResult.OK Then Dim myBitmapSmall As Bitmap For Each File In OpenFile.FileNames Dim myControl As New ucPictureBox ' this user control has a picturebox (pb), a textbox (txt), 2 buttons (btnClose and btnPreview) myBitmapSmall = New Bitmap(w, h) Using g As Graphics = Graphics.FromImage(myBitmapSmall) g.DrawImage(New Bitmap(File), 0, 0, w, h) End Using With myControl .ImageLocation = File .pb.Image = myBitmapSmall .txt.Text = Path.GetFileNameWithoutExtension(File) .ImageExt = Path.GetExtension(File) .ImageId = 0 ' under sa ucPictureBox, mag declare ka ng ImageId End With FlowLayoutPanel1.Controls.Add(myControl) ' may flowlayoutpanel sa form, para e dagdag nya ang control (ucPictureBox) sa form. System.Threading.Thread.Sleep(200) Next End If Catch ex As Exception MsgBox(ex.Message) End Try End Sub
Sir tnx po for this but i need po ung file explorer and viewer po help me po
here's a sample code, this will resize the image to a thumbnail, nasa button browse ang code na to (gawa ka nalang ng button)
Code:Imports System.Windows.Forms Imports System.Drawing Imports System.IO Private Const INT_h As Integer = 170 ' resize to desired thumbnail size Private Sub btnBrowse_Click(sender As Object, e As EventArgs) Handles btnBrowse.Click Dim OpenFile As New OpenFileDialog Dim result As DialogResult Dim File As String Dim w As Integer = INT_h Dim h As Integer = INT_h Try With OpenFile .Filter = "JPG|*.jpg|JPEG|*.jpeg|BMP|*.bmp|PNG|*.png|ALL|*.*" .Multiselect = True .Title = "Image Upload" result = .ShowDialog() End With If result = Windows.Forms.DialogResult.OK Then Dim myBitmapSmall As Bitmap For Each File In OpenFile.FileNames Dim myControl As New ucPictureBox ' this user control has a picturebox (pb), a textbox (txt), 2 buttons (btnClose and btnPreview) myBitmapSmall = New Bitmap(w, h) Using g As Graphics = Graphics.FromImage(myBitmapSmall) g.DrawImage(New Bitmap(File), 0, 0, w, h) End Using With myControl .ImageLocation = File .pb.Image = myBitmapSmall .txt.Text = Path.GetFileNameWithoutExtension(File) .ImageExt = Path.GetExtension(File) .ImageId = 0 ' under sa ucPictureBox, mag declare ka ng ImageId End With FlowLayoutPanel1.Controls.Add(myControl) ' may flowlayoutpanel sa form, para e dagdag nya ang control (ucPictureBox) sa form. System.Threading.Thread.Sleep(200) Next End If Catch ex As Exception MsgBox(ex.Message) End Try End Sub
Sir tnx po for this but i need po ung file explorer and viewer po help me po
there is an easy way and a hard way, easy way muna: if hindi contented sa easy way, then we go the hard way.
Code:Try ' If ImageId <= 0 Then MsgBox("Could not locate specified image on database.", MsgBoxStyle.OkOnly, "") Exit Sub End If Dim mData As New DataTable Dim mCommand As New MySqlCommand mCommand.CommandText = "SELECT columns FROM db_table WHERE column = @imageId;" mCommand.Parameters.AddWithValue("@imageId", ImageId) mData = mySQL.ExecuteQuery(mCommand) ' function ko to query sa database If mData IsNot Nothing Then ' cross checking if result has rows If mData.Rows.Count > 0 Then ' i am sure na may record akong nakuha Dim ImageRawData() As Byte = mData.Rows(0).Item("image") ' first item ng result Dim FileName As String If mData.Rows(0).Item("imageFileName").ToString = "" Then FileName = RandomStr() & mData.Rows(0).Item("extension").ToString ' put a random name to the file being fetched if blank Else FileName = String.Format("{0}{1}", mData.Rows(0).Item("imageFileName").ToString, mData.Rows(0).Item("extension").ToString) ' use its file name End If Process.Start(WriteToTempFile(ImageRawData, FileName)) ' open with default image viewer na naka install sa computer (e.g. mspaint, windows photo viewer) ' dito mo e alter si hard way, gawa ka ng sariling form na may picturebox and other functions like zoom, drag, etc... then itapon mo ang ImageRawData to the picturebox End If End If Catch ex As Exception MsgBox(ex.Message) End Try Public Shared Function WriteToTempFile(ByVal ImageRawData() As Byte, ByVal FileName As String) As String ' Writes image to a temporary file and returns path Dim strFilename As String = System.IO.Path.Combine(My.Computer.FileSystem.SpecialDirectories.Temp, FileName) Dim objFS As New System.IO.FileStream(strFilename, System.IO.FileMode.Append, System.IO.FileAccess.Write) objFS.Write(ImageRawData, 0, ImageRawData.Length) objFS.Flush() objFS.Close() Return strFilename End Function Public Function RandomStr() As String Const s As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" Dim r As New Random Dim sb As New StringBuilder For i As Integer = 1 To 8 Dim idx As Integer = r.Next(0, 35) sb.Append(s.Substring(idx, 1)) Next Return sb.ToString End Function
anyway, code is untested. i did not compile it.
guys, pano ko gagawin sa program ko yung pwede niya i-calculate yung years and months sa company yung tenures ng isang employee? salamat po.
For Each s In images
If s.Extension.ToLower = ".png" Or s.Extension.ToLower = ".jpg" Or s.Extension.ToLower = ".bmp" Or s.Extension.ToLower = ".gif" Or s.Extension.ToLower = ".tif" Then
If newLocx >= PictureBox1.Width - swidth - 10 Then
newLocx = locx
locy = locy + sheight + 30
newLocy = locy
Else
newLocy = locy
End If
loadimg(s.Name, s.FullName, newLocx, newLocy)
newLocx = newLocx + swidth + 10
newLocy = locy + sheight + 10
End If
Next
Paano ko po makukuha ung bawat file name nung pictures dyan ?
mga sir.. pahelp naman po.. about time and date... bakit po kapag nag sasave aq ng date from datetimepicker laging may kasamang time?.. binago qna po ung format nya into shortdatetime.. kaso ganun padin pag lumalabas sa listview
ex: 12/12/1993 12:00:00 any solution po?..
mga sir.. pahelp naman po.. about time and date... bakit po kapag nag sasave aq ng date from datetimepicker laging may kasamang time?.. binago qna po ung format nya into shortdatetime.. kaso ganun padin pag lumalabas sa listview
ex: 12/12/1993 12:00:00 any solution po?..
guys, ano mali dito sa code ko? kasi pag nag-vview na ng records ndi lumalabas yung selected data eh! sa crystal report. Pero Nag-vview naman yung report wala lang data. by the way i'm using VS2013 and Crystal Report
Private Sub FrmProfile_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim cryRpt As New ReportDocument
cn.Open()
With cmd
.Connection = cn
.CommandText = "SELECT * FROM employee WHERE ID = " & FrmProfileGridView.MTProfile.SelectedRows(0).Cells(0).Value.ToString() & ""
End With
da.SelectCommand = cmd
dt15.Clear()
da15.Fill(dt15)
FrmProfileGridView.MTProfile.DataSource = dt15
cryRpt.Load("C:\empsys\WindowsApplication3\empprofile.rpt")
CrystalReportViewer1.SelectionFormula = " {employee.Emp_ID} = '" & FrmProfileGridView.MTProfile.SelectedCells(0).Value & "'"
CrystalReportViewer1.ReportSource = cryRpt
CrystalReportViewer1.Refresh()
cn.Close()
End Sub
i could not debug your code since di ko nakikita ang initialization mo ng da, cn, at dt15, but considering your code, ang error mo is: walang laman ang datatable mo.
da.selectcommand = cmd
dt15.clear ' <-- datatable
da.fill(dt15) '<--- put the fetched record to the datatable using the dataadapter
yourgrid.datasource = dt15
*** EDIT *** please avoid the string concatenation in command text, instead use its parameter
.CommandText = "SELECT * FROM employee WHERE ID = " & FrmProfileGridView.MTProfile.SelectedRows(0).Cells(0).Value.ToString() & ""
.CommandText = "SELECT * FROM employee WHERE ID = @mySelectedId"
.Parameters.AddWithValue("@mySelectedId", FrmProfileGridView.MTProfile.SelectedRows(0).Cells(0).Value.ToString())
TS! bale ganito na ginawa ko after nung path/location ng report inadd ko ito *cryRpt.SetDataSource(dt15). ang nagiging error naman is ganito:
View attachment 1055140
pero kong di ko ilalagay yun nag-bbrowse naman yun ganito naman nagiging error sa report ko
View attachment 1055141
by the way this is the output pala ng report ko bale dapat is selected lang yung lalabas na employee diyan
View attachment 1055143