|
Hello every one,
I have a VB 2005 application in which i let the user to store an image in DB.
The users upload really huge images, which are of no good for the application as well.
Is there any method by which I can resize / reduce / shrink the image's physical size, in vb.net
Regards
Nishkarsh
|
|
|
|
|
Sure - you can call a method on the bitmap class to return a thumbnail, or you can manually resize it, by creating a new smaller bitmap and drawing the image onto it.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks for the response
I was trying things like that on my own and saw something which i need some support on to make my understanding
- I created a sample application with one picture box, one button and one text box
- I loaded a picture(JPEG) in the picture box at design time, of size 2834 KB and dimensions 2816x2112
- On the click of button first thing i do is sane the image from the picture box to "c:\picorg.jpg" as jpg, the size of this picture got reduced to 494KB and dimensions were same as 2816x2112
- Now after that i took ".3" which was entered in the text box and reduced the picture and saved it... I got a really low size and picture dimensions also reduced..
I issue who did the size of picture reduced when i had only loaded it in picture box and the dimensions did not changed..
Regards
Nishkarsh
|
|
|
|
|
The orginal JPEG was probably saved at 90% quality. GDI+ JPEG by default saves it at 75% quality.
|
|
|
|
|
Can we control the quality of image save?
Also, which are the functions of bitmap class were you referring to, can you give some examples also...
I will explain you the whole issue..
- I want to first find the image size
- If the size id bigger then a predefined sizes then reduce the image size and then send it to DB..
Hope that you can help me out with the needful
Regards
Nishkarsh
|
|
|
|
|
You get the original image size from the dimensions of the image and the PixelFormat, but I think you are interested in the file size which you can get a variety of ways from IO. You change the encoder quality by the Quality EncoderParameter. There is no direct relation between file size and encoder quality other than lower quality results in smaller files.
|
|
|
|
|
Hi guys i am working in vb.net 2005,
i want to get some user interface like help ,i cannot develop some good interfaces or i have
nomore new ideas to develop some other interfaces .can any body help me out how to improve my
interface development skills , any link from where i could get some good interface based applicaions.
hello
|
|
|
|
|
There is a microsoft book on interface design, I guess you could buy that
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi,
I want to write some values into HKEY_CLASSES_ROOT but when i try to do so i get the message that i don't have the permission. (Using Vista). So, is there any way to let my program run as Administrator, without the user right-clicking on the file and choose Run as Administrator?
Thanks in advance,
--Zaegra--
|
|
|
|
|
Nope, there's not a way to run an application as admin without having to log on with an admin account. You need to write registry values to a different part of the registry (HKEY_CURRENT_USER in stead of HKEY_LOCAL_MACHINE) or use .NET's isolated stored functionality which I'd prefer...
|
|
|
|
|
I would've done so, if only I wasn't registering a filetype, which has to be stored in HKEY_CLASSES_ROOT. So there is no way doing this, without the user right clicking on the file and run as administrator?
|
|
|
|
|
In that case, you need to register file type (i guess for file type association) during setup and not from within your application. Else you should require the correct permissions and not run the application if the user doesn't have sufficient rights..
|
|
|
|
|
Good Morning All
I have a Login(frmlogin) form and an MDI form(frmmain), i have a Function that check against the DB if the username and password exists and if they do, it will return '1', if it ruturns '1', i will know that the login is valid, and i will have to Close the login form and show the main Window. in my Application "frmlogin" is a Startup form. i have written the explain procedure like this.
Dim frmmain As New frmmain<br />
<br />
Dim strusername As String = txtusername.Text<br />
<br />
Dim strPassword As String = txtpassword.Text<br />
<br />
Dim obj As New BLL.Client<br />
<br />
Dim bl As Integer<br />
<br />
Try<br />
bl = obj.Check_Login(strusername, strPassword)<br />
<br />
If bl = 1 Then<br />
frmmain.Show()<br />
<br />
frmLogin.ActiveForm.Close()<br />
<br />
Else<br />
<br />
MessageBox.Show("Invalid Login")<br />
<br />
End If<br />
<br />
Catch ex As Exception<br />
<br />
MessageBox.Show(ex.Message)<br />
<br />
End Try
This is the code in my "frmlogin", My problem is that when the login is Valid, The frmmain window is Shown, but the login does not Disappear.
What is the Problem?
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Hi,
U can't close the statrup form so my suggestion is
Make the Mdi form as a startup form and on load event of mdi open the login form if login is authorized then ok other wise u can end the application or prompt that enter valid user name n password
The Great Pleasure In Doing That Things That Other People Say U Can't By Doing This U Can Shut Their Mouth
|
|
|
|
|
The Problem was Solved this way
I used a Main method in a module as my startup object:
Friend Module Startup <br />
Public Sub Main()<br />
Dim loggedIn As Boolean<br />
dim login As New frmlogin<br />
loggedIn = (login.ShowDialog() = DialogResult.OK)<br />
If loggedIn Then <br />
Application.Run(New MainForm)<br />
End If <br />
End Sub <br />
End Module
my login form would look like this:
Dim strusername As String = txtusername.Text<br />
<br />
Dim strPassword As String = txtpassword.Text<br />
<br />
Dim obj As New BLL.Client<br />
<br />
Dim bl As Integer<br />
<br />
Try<br />
bl = obj.Check_Login(strusername, strPassword)<br />
<br />
If bl = 1 Then<br />
<br />
Me.DialogResult = Windows.Forms.DialogResult.OK<br />
<br />
Else<br />
<br />
MessageBox.Show("Invalid Login")<br />
<br />
End If<br />
<br />
Catch ex As Exception<br />
<br />
MessageBox.Show(ex.Message)<br />
<br />
End Try
Now the login dialogue will be dismissed if and only if the user either successfully logs in or cancels the operation. If the user does not successfully log in the app will exit without ever creating an unnecessary main form
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
just try Hide instead of close and before that open the MDI. So the application will continue to be in running state or else the application may close
thanks
Mohanraj D
RAJA
|
|
|
|
|
Hi,
I wanna deploy my Vb.net application so i created SetUp for it,
but the problem is that when i install it on Client's Pc it ask for first install .Net Framework (Which is not installed in Pc)
So is there any way to create SetUp Completely(.NetFrameWork+CrystalReport+Sql Server) Without seperately installation of .Net Framwork ,Crystal Report and Sql Server
Thanks with anticipation
The Great Pleasure In Doing That Things That Other People Say U Can't By Doing This U Can Shut Their Mouth
|
|
|
|
|
|
Thanks 4 ur reply
The Great Pleasure In Doing That Things That Other People Say U Can't By Doing This U Can Shut Their Mouth
|
|
|
|
|
Welcome
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Hi Frnds..
I hv developed a Bill Contract Software in Vb.Net 2005(Windows application) , using vb as a language and msaccess as backend. I want to store all the data in the server. So i hv copied msaccess file to my personal domain inside wwwroot folder.
Now i dont want to store data in my PC. It should be stored in the server directly. Can anyone tell me what is the connection string for that...
Thank you...
|
|
|
|
|
Yes, it's a path to the mdb, across the network to the server machine.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks..
But plse tell me how to give the path..
|
|
|
|
|
hi
try looking in here...http://www.carlprothman.net/Default.aspx?tabid=81
|
|
|
|
|
hi,
simply create a log file, which store the path of your database.
Let me explain
first of all , make a form which ask from user for database path and set this form as startup form. Now at load event of this form check whether logfile(path.txt) is exist or not and perform action according to condition. I use following code in most appliction
If File.Exists(Application.StartupPath & "\Path.txt") Then<br />
FileClose(1)<br />
Dim s As String<br />
FileOpen(1, "path.txt", OpenMode.Input)<br />
Input(1, s)<br />
Dim FilePath As String<br />
FilePath = s<br />
TextBoxSetDatabasePath.Text = FilePath<br />
If File.Exists(FilePath) Then<br />
FilePath = FilePath.Substring(FilePath.LastIndexOf("\") + 1)<br />
If FilePath.Trim.ToUpper = "YOURDATABASENAME.MDB" Then<br />
DatabasePath = TextBoxSetDatabasePath.Text.Trim ' DatabasePath is global variable<br />
LoginForm1.Show()<br />
Me.Close()<br />
Else<br />
msgbox("Wrong database file. Please choose correct database file")<br />
End If<br />
<br />
Else<br />
msgbox(("Database file not found. Please choose the database file.")<br />
End If<br />
Else<br />
mdChecking.Prompt("Database Path not set. Please choose Database file.")<br />
End If
use databasepath varible value in connectionstring.
for prompt user to pick correct database file use following procedure
Try<br />
<br />
If TextBoxSetDatabasePath.Text <> "" Then<br />
If Not File.Exists(TextBoxSetDatabasePath.Text.Trim) Then<br />
mdChecking.Prompt("Incorrect database file. Please choose correct database file")<br />
Exit Sub<br />
Else<br />
Dim FilePath As String = TextBoxSetDatabasePath.Text.Trim<br />
<br />
FilePath = FilePath.Substring(FilePath.LastIndexOf("\") + 1)<br />
If FilePath.Trim.ToUpper = ""YOURDATABASENAME.MDB".MDB" Then<br />
DatabasePath = FilePath.Trim<br />
<br />
'If File.Exists(Application.StartupPath & "\path.txt") Then<br />
' File.Delete(Application.StartupPath & "\path.txt")<br />
'End If<br />
Dim s As String<br />
FileClose(1)<br />
s = Application.StartupPath & "\path.txt"<br />
FileOpen(1, s, OpenMode.Output)<br />
WriteLine(1, TextBoxSetDatabasePath.Text)<br />
<br />
FileClose(1)<br />
LoginForm1.Show()<br />
Me.Close()<br />
Else<br />
msgbox("Wrong database file. Please choose correct database file")<br />
End If<br />
<br />
End If<br />
Else<br />
msgbox("Database path is not set. Please choose database file")<br />
End If<br />
Catch ex As Exception<br />
MsgBox(ex.Message, MsgBoxStyle.Information, Me.Text)<br />
End Try
hope this helps
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|