|
Hello experts!!
I have to move picture box on to form,for static image it works but for multiimages in same picture box dont know how to handle.
if i take all images path into an array then i must show it in picturebox.but dont know how to take path into an array?
Can anybody tell me how to do it???
for any idea always welcome!!
|
|
|
|
|
As you've discovered, a PictureBox only shows one picture at a time. If you want to show multiple pictures, then you need to either have an collection of PictureBoxes, or draw the images onto the PictureBox's Image manually. Look up the System.Drawing namespace for details, or search Google
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
I am not sure about what you are asking for, but following snippet code demonstrating how to work with PictureBox and array:
Public Class Form1
Private arrImages() As String
Const PicNumber As Integer = 3
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
ReDim arrImages(PicNumber - 1)
arrImages(0) = "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Blue hills.jpg" '"Path1"
arrImages(1) = "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Sunset.jpg" '"Path2"
arrImages(2) = "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water lilies.jpg" '"Path3"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Static ind As Integer
ind = ind Mod (PicNumber)
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
PictureBox1.Image = Image.FromFile(arrImages(ind))
ind += 1
End Sub
End Class
Instead of Button1, you can put a timer that will display your pictures like presentation (you may have to add Application.Doevents in the timer event)
Shay Noy
|
|
|
|
|
thanx,it worked... ...do you know how to add images into array from folder?
|
|
|
|
|
Declare array with 'Image' type
dim Picarray (1) as Image
Picarray(0) = System.Drawing.Image.Fromfile(ImagePath)
Picarray(1) = System.Drawing.Image.Fromfile(ImagePath)
|
|
|
|
|
You know the questions you are asking are very simple for beeing found in google. You only have to work a little and enter in google something like that: "load images from folder to array + vb.net" OR "updload inages from folder" etc...
The snippet code should be something like that: (I didn't compile or run it, but this is the concept)
private sub f()
dim fld as new IO.directoryinfo(YourFolderPath)
dim arrImages() as string 'or images as you need
dim ind as integer =0
for each fil as IO.fileInfo in fld.getFiles("*.your extension")
redim preserve arrImages(ind)
arrImages(ind)=... 'like the first answer I gave you
ind+=1
next
fld=nothing
end sub
Shay Noy
|
|
|
|
|
Your posted code helped me also but i have one more query -How to take images dynamically means i dont know images name.If i replace all images from same folder then what to do??
So i want code for that in which image name is not fix....
|
|
|
|
|
If I understood your question, you do not have to know image name. When you loop into the folder that contains all the images, the name property of the fil (as IO.FIleInfo) variable handle the name of the image file.
Shay Noy
|
|
|
|
|
ok,i got it but can you please tel me code at following line posted earlier by you which solve my problem and confusion...
arrImages(ind)=... 'like the first answer I gave you
In first reply you wrote there path of file...thats why i am confuse..
Kidya
|
|
|
|
|
Option Explicit On
Imports System.IO
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim fld As New DirectoryInfo("C:\MyPictures\")
Dim arrImages() As String, ind As Integer = 0
For Each fil As FileInfo In fld.GetFiles("*.jpg")
ReDim Preserve arrImages(ind)
arrImages(ind) = fil.FullName
ind += 1
Next
End Sub
End Class
hope it helps you
Shay Noy
|
|
|
|
|
Thanx ...It helped me more..
|
|
|
|
|
Hi,
Am a student studying information technology and try to develop an online hotel reservation system in visual basic 6.0 as my personal project to improve on my programming skills. I tried to code part of the customer data page and now i,ve failed to proceed. I welcome any kind of help and even on how the system is supposed to be laid.
Any help will be treated with high respect.
Thanks in advance.
Kimbowa Sande
|
|
|
|
|
kimbowa sande wrote: visual basic 6.0
STOP You are absolutely WASTING your time, download a copy of VB.Net express off the internet - it is FREE, no cost, no licence issue, nothing. Microsoft WANT you to have a copy
here is a link [^]
Now go out and buy, yes spend a little money, a book on VB.net. Spend some time getting to know VB.Net and then come back when you have a little knowledge and we'll help where we can.
I suggest you also get a book on database design as well, you will need it.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
kimbowa sande wrote: visual basic 6.0
Don't.
vb6 is ancient, it's no good and never was, it's no longer supported.
Like Mycroft Holmes said use .NET
kimbowa sande wrote: Am a student studying information technology
I find it very hard to believe that vb6 is still being given at schools.
If so please tell me what school so I can personally go set them right.
kimbowa sande wrote: try to develop an online hotel reservation system
Online indicates this is a web application. So better forum might have been the ASP.NET forum.
|
|
|
|
|
Tom Deketelaere wrote: I find it very hard to believe that vb6 is still being given at schools.
I've been interviewing graduates this week. Quite a few have VB6 classes on their CV - it is quite disheartening.
|
|
|
|
|
Tom Deketelaere wrote: it's no good and never was
Despite that fact, it sold well. Lots of small "software" shops that sold VB6-based applications, lots of brownfields left
Tom Deketelaere wrote: I find it very hard to believe that vb6 is still being given at schools.
It is in the countries where the hardware is somewhat older - one has to use legacy-software. I can't imagine Vista on a 486.
I are troll
|
|
|
|
|
kimbowa sande wrote: I tried to code part of the customer data page
What is a "customer data page"?
May I suggest that you start by writing out use cases (short stories of how various users will interact with the system. A customer wants to do X, the hotel receptionist needs to check in a customer, the hotel receptionist needs to check out a customer, the customer wants a room for 4 people, etc.)
|
|
|
|
|
Hi SIR
Iam sorry for delaying. Here is the way i would like it to operate.
A client being able to place an order both locally and online,order and payment details stored and room number allocated.on arrival,the clients finger prints,image(biometrics)entered.the system able to remaind the user about new and old orders still standing and when an order is ending.the user having limited writes and the administrater having all the writes to view new and old orders.system able to sent e-mails to prominent clients usually about new services and greetings.
New and interested in learning visual basic
THANKS IN ADVANCE
|
|
|
|
|
Okay - Now break that down in to smaller pieces. To help you get started here are some questions you need to ask yourself
kimbowa sande wrote: A client being able to place an order both locally and online
How will a client be able to place an order online? What is the process? What information does the system need? What information does the client have?
What does "place an order locally" mean?
kimbowa sande wrote: order and payment details stored
How do you want to store this information? Do you have any constraints? For example, if you are storing payment details then you will have to be PCI (Payment Card Industry) Compliant - Which is very time consuming and expensive. Many companies use a third party payment processor so they don't have to worry so much. They only have to worry about the transmission of payment details and never the storage.
kimbowa sande wrote: the clients finger prints,image(biometrics)entered
Why do you need this? Do you think some customers may react negatively to it?
kimbowa sande wrote: system able to sent e-mails to prominent clients usually about new services and greetings.
Do you really need the system to do this? Normally, you would extract the email addresses needed and use a third party system to send out marketing mails.
|
|
|
|
|
hi guys..can u tell me how to add sql statement in my code
here's my code for the form load..
Private Sub frmManager_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'UserDataSet2.Staffapplication' table. You can move, or remove it, as needed.
Me.StaffapplicationTableAdapter.Fill(Me.UserDataSet2.Staffapplication)
txtRecordno.DataBindings.Add("Text", UserDataSet2, "Staffapplication.Srecordno")
txtUsername.DataBindings.Add("Text", UserDataSet2, "Staffapplication.Sname")
txtPassword.DataBindings.Add("Text", UserDataSet2, "Staffapplication.Spassword")
txtHobby.DataBindings.Add("Text", UserDataSet2, "Staffapplication.Shobby")
End Sub
i want those textboxes to displayed only data for a particular person
something like
"Select * from Staffapplication where MID ='" & frmLeave.txtUser.Text & "'"
how to add the sql statement in my code??
|
|
|
|
|
hi guys..im having a problem with my delete button
(let's say my database has 3 records)
and while my form is showing record no.3, and i clicked on the delete button, it will delete record no.1..(it supposed to be deleting record no.3)....how to correct my code and make it delete the record shown on the form????
here's my code..
Private Sub frmManager_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'UserDataSet2.Staffapplication' table. You can move, or remove it, as needed.
Me.StaffapplicationTableAdapter.Fill(Me.UserDataSet2.Staffapplication)
txtRecordno.DataBindings.Add("Text", UserDataSet2, "Staffapplication.Srecordno")
txtUsername.DataBindings.Add("Text", UserDataSet2, "Staffapplication.Sname")
txtPassword.DataBindings.Add("Text", UserDataSet2, "Staffapplication.Spassword")
txtHobby.DataBindings.Add("Text", UserDataSet2, "Staffapplication.Shobby")
End Sub
______________________________________________________________
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
Dim intresult As Integer
Try
intresult = MessageBox.Show("Confirm Delete?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If intresult = Windows.Forms.DialogResult.Yes Then
Me.StaffapplicationBindingSource.RemoveCurrent()
Me.StaffapplicationTableAdapter.Update(Me.UserDataSet2.Staffapplication)
End If
Catch ex As Exception
End Try
(note: im using bindingSource for my textboxes anyway)
|
|
|
|
|
hi,
i have created simple billing software in vb.net with ms access.
Now i want to print all purchase, sales details or something..
but when we are going to print before see the print preview.
its all showing whatever in Query.
When i took print,nothing printing from db. but print other than DB.
i have attached sample code for mine.Plz Help me Urgent.
Private Sub Print_JOB_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
TOT = 0
INCR = 0
Sno = 1
PAGE_LIMIT = PER_PAGE
myConnection = New OleDbConnection(constr)
MyCommand.Connection = myConnection
'MyCommand.CommandText = "SELECT JOB_NAME,JOB_AMT FROM JOBCARD WHERE JOBNO=" + G_JOBNO + ""
MyCommand.CommandText = "SELECT JOB_NAME,JOB_AMT FROM JOBCARD WHERE JOBNO=128"
MyCommand.CommandType = CommandType.Text
ada.SelectCommand = MyCommand
ada.Fill(ds, "SALES_JOBMASTER")
dt = ds.Tables(2)
Data_Adapter()
' ROW_COUNT = ds.Tables(2).Rows.Count
ROW_COUNT = 3
'Me.Close()
'ROW_COUNT = 3
dlgPrintPreview.Document = PreparePrintDocument()
dlgPrintPreview.WindowState = FormWindowState.Maximized
dlgPrintPreview.ShowDialog()
Catch ex As Exception
WAR(ex.ToString)
End Try
End Sub
Private Function PreparePrintDocument() As PrintDocument
Dim print_document As New PrintDocument
AddHandler print_document.PrintPage, AddressOf Spare_Print_PrintPage
Return print_document
End Function
Private Sub Spare_Print_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles Spare_Print.PrintPage
Try
g = e.Graphics
DB()
g.DrawString(COMNAME, CNAME, brush, New Point(300, 25))
g.DrawString(DEALER, DNAME, brush, New Point(350, 50))
g.DrawString(ADD1 + " " + ADD2 + " " + CITY, FNT, brush, New Point(100, 70))
g.DrawString("Phone : " + PHONE + " " + "Mobile : " + MOBILE, FNT, brush, New Point(100, 90))
g.DrawString("TIN: " + TIN + " " + "Dt: " + TINDATE + " " + "Area Code: " + TINAREA, FNT, brush, New Point(100, 110))
'g.DrawLine(mypen, 20, 140, 820, 140) ';//Draw Horizondal Line
g.DrawString("---------------------------------------------------------------------------------------------------------------------------------------------------", FNT, brush, New Point(20, 135))
g.DrawString("*** JOB INVOICE ***", FNT, brush, New Point(300, 155))
g.DrawString("---------------------------------------------------------------------------------------------------------------------------------------------------", FNT, brush, New Point(20, 170))
'g.DrawLine(mypen, 20, 175, 820, 175) ';//Draw Horizondal Line
g.DrawString("To, ", FNT, brush, New Point(30, 180)) ';// Get company Address
g.DrawString("Mr." + CustName, FNT, brush, New Point(80, 200)) ';// Get company Address
Dim t As Double = 220
g.DrawString(Address1 + " " + CustCity, FNT, brush, New Point(100, t)) ';// Get company Address
t = t + 70
g.DrawString("Phone : ", FNT, brush, New Point(50, t)) ';// Get company Address
g.DrawString(CustPhone, FNT, brush, New Point(145, t)) ';// Get company Address
g.DrawString("Mobile : ", FNT, brush, New Point(370, t)) ';// Get company Address
g.DrawString(CustMobile, FNT, brush, New Point(440, t))
g.DrawString("Invoice No : ", FNT, brush, New Point(550, 200)) ';//Get company Code.no
g.DrawString(G_BNO, FNT, brush, New Point(650, 200))
g.DrawString("Date : ", FNT, brush, New Point(550, 230))
g.DrawString(G_DATE, FNT, brush, New Point(650, 230))
g.DrawString("Last KM Reading : ", FNT, brush, New Point(550, 260))
g.DrawString(KM, FNT, brush, New Point(720, 260))
'g.DrawLine(mypen, 20, 315, 820, 315) ';//Horizondal line
g.DrawString("Vehicle No : " + VechNo, FNT, brush, New Point(50, 320)) ';// Get company Address
g.DrawString("Make : " + Make, FNT, brush, New Point(370, 320)) ';// Get company Address
g.DrawString("Model : " + Model, FNT, brush, New Point(600, 320)) ';// Get company Address
'g.DrawLine(mypen, 20, 345, 820, 345) ';//Horizondal line
g.DrawString("---------------------------------------------------------------------------------------------------------------------------------------------------", FNT, brush, New Point(20, 330))
g.DrawString("No", FNT, brush, New Point(40, 350)) ';//
g.DrawString("Particulars", FNT, brush, New Point(150, 350))
g.DrawString("Amount", FNT, brush, New Point(670, 350))
g.DrawString("---------------------------------------------------------------------------------------------------------------------------------------------------", FNT, brush, New Point(20, 365))
'g.DrawLine(mypen, 20, 375, 820, 375) ';//Horizondal line
'Data_Adapter()
Dim yy, zz As Integer
Dim Qty As Decimal
x = 125
y = 380
y1 = 380
' MsgBox(ds.Tables(2).Rows(1).Item(1).ToString())
'MsgBox(dt.Rows.Count)
originalx = x
'ROW_COUNT = ds.Tables(2).Rows.Count
Dim rw, col As Integer
rw = ds.Tables(2).Rows.Count - 1
col = ds.Tables(2).Columns.Count - 1
' zz = dt.Rows.Count
For yy = 0 To PER_PAGE
If ROW_COUNT = INCR Then
GoTo CC
End If
For zz = 0 To col
Masktxt.Text = Sno.ToString 'FOR SNO
char_count = Masktxt.Text.Length
If char_count = 4 Then
g.DrawString(Masktxt.Text + ".", FNT, brush, New Point(10, y1))
ElseIf char_count = 3 Then
g.DrawString(Masktxt.Text + ".", FNT, brush, New Point(21, y1))
ElseIf char_count = 2 Then
g.DrawString(Masktxt.Text + ".", FNT, brush, New Point(32, y1))
ElseIf char_count = 1 Then
g.DrawString(Masktxt.Text + ".", FNT, brush, New Point(40, y1))
Else
g.DrawString(Masktxt.Text + ".", FNT, brush, New Point(10, y1))
End If
'g.DrawString(Sno.ToString() + ".", FNT, brush, New Point(65, y1))
If COUNT = 1 Then 'JOB NAME
g.DrawString(ds.Tables(2).Rows(INCR).Item(zz).ToString(), FNT, brush, New Point(100, y))
ElseIf COUNT = 2 Then 'AMT
'g.DrawString(ds.Tables(2).Rows(INCR).Item(zz).ToString(), FNT, brush, New Point(630, y))
Qty = ds.Tables(2).Rows(INCR).Item(zz).ToString()
Masktxt.Text = Format(Qty, "#.00")
char_count = Masktxt.Text.Length
If char_count = 10 Then
g.DrawString(Masktxt.Text, FNT, brush, New Point(640, y))
ElseIf char_count = 9 Then
g.DrawString(Masktxt.Text, FNT, brush, New Point(650, y))
ElseIf char_count = 8 Then
g.DrawString(Masktxt.Text, FNT, brush, New Point(660, y))
ElseIf char_count = 7 Then
g.DrawString(Masktxt.Text, FNT, brush, New Point(672, y))
ElseIf char_count = 6 Then
g.DrawString(Masktxt.Text, FNT, brush, New Point(683, y))
ElseIf char_count = 5 Then
g.DrawString(Masktxt.Text, FNT, brush, New Point(693, y))
ElseIf char_count = 4 Then
g.DrawString(Masktxt.Text, FNT, brush, New Point(705, y))
Else
Masktxt.Text = Format(Qty, "#")
g.DrawString(Masktxt.Text, FNT, brush, New Point(620, y))
End If
TOT += Qty
End If
COUNT += 1
Next
y += 25 ';//Next Column
y1 += 25 ';//Next Colum
COUNT = 1
Sno += 1
INCR += 1
Next
CC:
GrandTot = Round(TOT)
MaskVATToT1.Text = Format(GrandTot, "#.00") 'ROUND AMT
MaskVATToT2.Text = Format(TOT, "#.00") 'TOT AMT
char_count = MaskVATToT2.Text.Length
If char_count = 10 Then
g.DrawString(MaskVATToT2.Text, FNT, brush, New Point(638, 880))
g.DrawString(MaskVATToT1.Text, FNT, brush, New Point(638, 920))
ElseIf char_count = 9 Then
g.DrawString(MaskVATToT2.Text, FNT, brush, New Point(650, 880))
g.DrawString(MaskVATToT1.Text, FNT, brush, New Point(650, 920))
ElseIf char_count = 8 Then
g.DrawString(MaskVATToT2.Text, FNT, brush, New Point(660, 880))
g.DrawString(MaskVATToT1.Text, FNT, brush, New Point(660, 920))
ElseIf char_count = 7 Then
g.DrawString(MaskVATToT2.Text, FNT, brush, New Point(672, 880))
g.DrawString(MaskVATToT1.Text, FNT, brush, New Point(672, 920))
ElseIf char_count = 6 Then
g.DrawString(MaskVATToT2.Text, FNT, brush, New Point(683, 880))
g.DrawString(MaskVATToT1.Text, FNT, brush, New Point(683, 920))
ElseIf char_count = 5 Then
g.DrawString(MaskVATToT2.Text, FNT, brush, New Point(694, 880))
g.DrawString(MaskVATToT1.Text, FNT, brush, New Point(694, 920))
ElseIf char_count = 4 Then
g.DrawString(MaskVATToT2.Text, FNT, brush, New Point(706, 880))
g.DrawString(MaskVATToT1.Text, FNT, brush, New Point(706, 920))
Else
g.DrawString(MaskVATToT2.Text, FNT, brush, New Point(638, 880))
g.DrawString(MaskVATToT1.Text, FNT, brush, New Point(638, 920))
End If
'g.DrawLine(mypen, 20, 950, 820, 950) ';//Horizondal line
g.DrawString("---------------------------------------------------------------------------------------------------------------------------------------------------", FNT, brush, New Point(20, 860))
g.DrawString(RupeesToWord(Val(MaskVATToT1.Text)), FNT, brush, New Point(50, 955))
g.DrawString("---------------------------------------------------------------------------------------------------------------------------------------------------", FNT, brush, New Point(20, 935))
'g.DrawLine(mypen, 20, 980, 820, 980) ';//Horizondal line
g.DrawString("For,", FNT, brush, New Point(560, 1000))
g.DrawString("(" + COMNAME + ")", FNT, brush, New Point(580, 1070))
g.DrawString("---------------------------------------------------------------------------------------------------------------------------------------------------", FNT, brush, New Point(20, 970))
'g.DrawLine(mypen, 20, 870, 820, 870) '//Horizondal line
g.DrawString("Total", FNT, brush, New Point(530, 880))
g.DrawString("-------------------------------------------------", FNT, brush, New Point(585, 900))
'g.DrawLine(mypen, 585, 910, 820, 910) ';//Horizondal line
g.DrawString("Grand Total", FNT, brush, New Point(470, 920))
RESET()
' If we have more paragraphs, we have more pages.
PAGE_LIMIT = ROW_COUNT - INCR
If PAGE_LIMIT > 0 Then
'Reset()
e.HasMorePages = True
Else
e.HasMorePages = False
End If
Catch ex As Exception
WAR(ex.ToString)
End Try
End Sub
Yours,
KaNNaN
-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"
Mail To : foreverkans@gmail.com
|
|
|
|
|
Please format your code properly and rephrase your question into something a little more understandable, I can't quite get as to what the issue is.
Also, remove your email from your signature, unless you like spam.
|
|
|
|
|
Greetings.
First of all I am not looking for the entire code, I need your help to direct me or give some suggestions.
From VB.NET, will I be able to write a string to a word document which is already open (I can see the word doc in taskbar)? I was able to get the file name of the word doc that's in taskbar but failed to activate it or write on it.
So, from VB.NET, I need to activate or get the word doc which is up and running with a file name of "Musa.doc" and write some text to the word doc...
Any suggestion will be very helpful.
Thanks in advance.
Musa.Biralo
|
|
|
|
|
Unless there's a way in the Office tools to interact with an open doc, I fear your issue will be that the file is in use.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|