Click here to Skip to main content
15,914,074 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: add sum from list Pin
Andrew Stampor18-Nov-02 11:24
Andrew Stampor18-Nov-02 11:24 
GeneralRe: add sum from list Pin
Golfmaltais19-Nov-02 5:42
sussGolfmaltais19-Nov-02 5:42 
GeneralRe: add sum from list Pin
Andrew Stampor19-Nov-02 10:13
Andrew Stampor19-Nov-02 10:13 
GeneralFun with OpenUrl Pin
Andrew Stampor18-Nov-02 8:40
Andrew Stampor18-Nov-02 8:40 
Generaldropdownlist as templatecolumn in datagrid [web] Pin
mschilli18-Nov-02 1:57
mschilli18-Nov-02 1:57 
GeneralVB.net Resource Pin
Nick Seng17-Nov-02 15:58
Nick Seng17-Nov-02 15:58 
GeneralTelephony Pin
SuperGeek16-Nov-02 6:08
SuperGeek16-Nov-02 6:08 
GeneralGetEncoderInfo Pin
Zulfikar Ali15-Nov-02 7:28
Zulfikar Ali15-Nov-02 7:28 
I am working on a multiframe .Tiff editor. I am trying to save several .tiff files into one file. There is C# example in http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdrawingimagingencoderclasssaveflagtopic.asp

I have converted it to VB .NET.

private sub SaveTiff()
Dim multi As Bitmap
Dim page2 As Bitmap
Dim page3 As Bitmap
Dim myImageCodecInfo As ImageCodecInfo
Dim myEncoder As Encoder
Dim myEncoderParameter As EncoderParameter
Dim myEncoderParameters As EncoderParameters

' Create three Bitmap objects.
multi = New Bitmap("0.tif")
page2 = New Bitmap("1.tif")
page3 = New Bitmap("2.tif")

' Get an ImageCodecInfo object that represents the TIFF codec.
myImageCodecInfo = GetEncoderInfo("image/Tiff")


' Create an Encoder object based on the GUID
' for the SaveFlag parameter category.
myEncoder = Encoder.SaveFlag
' Create an EncoderParameters object.
' An EncoderParameters object has an array of EncoderParameter
' objects. In this case, there is only one
' EncoderParameter object in the array.
myEncoderParameters = New EncoderParameters(1)
' Save the first page (frame).
myEncoderParameter = New EncoderParameter(myEncoder, CLng(EncoderValue.MultiFrame))
myEncoderParameters.Param(0) = myEncoderParameter
multi.Save("C:\Projects\FaxView\save.tif", myImageCodecInfo, myEncoderParameters)
' Save the second page (frame).
myEncoderParameter = New EncoderParameter(myEncoder, CLng(EncoderValue.FrameDimensionPage))
myEncoderParameters.Param(0) = myEncoderParameter
multi.SaveAdd(page2, myEncoderParameters)
' Save the third page (frame).
myEncoderParameter = New EncoderParameter(myEncoder, CLng(EncoderValue.FrameDimensionPage))
myEncoderParameters.Param(0) = myEncoderParameter
multi.SaveAdd(page3, myEncoderParameters)
' Close the multiple-frame file.
myEncoderParameter = New EncoderParameter(myEncoder, CLng(EncoderValue.Flush))
myEncoderParameters.Param(0) = myEncoderParameter
multi.SaveAdd(myEncoderParameters)
end sub

Private Shared Function GetEncoderInfo(ByVal mimeType As [String]) As
ImageCodecInfo
Dim j As Integer
Dim encoders() As ImageCodecInfo
encoders = ImageCodecInfo.GetImageEncoders()

j = 0
While j < encoders.Length
If encoders(j).MimeType = mimeType Then
Return encoders(j)
End If
j = j + 1
End While
Return Nothing
End Function

myImageCodecInfo is retunring nothing. In the GetEncoderInfo function I am increasing j by + 1. But in the MSDN c# example it is missing. If i don't increase J by +1, gives infinite loop.

If you have any idea why it is happening, that would be great be Confused | :confused: Confused | :confused: great. Confused | :confused: Confused | :confused: ThanksConfused | :confused: Confused | :confused:

Zulfikar Ali
GeneralRe: GetEncoderInfo Pin
Zulfikar Ali15-Nov-02 7:42
Zulfikar Ali15-Nov-02 7:42 
Generaldata source locator Pin
ale8415-Nov-02 3:39
ale8415-Nov-02 3:39 
Generalvb.net... progressbar Pin
qazx15-Nov-02 2:40
qazx15-Nov-02 2:40 
QuestionHow to invoke the default mail client from VC Pin
Deepti13-Nov-02 23:52
Deepti13-Nov-02 23:52 
GeneralWinsock control Pin
Shamoon13-Nov-02 20:08
Shamoon13-Nov-02 20:08 
Generalwindows control library Pin
codemagician13-Nov-02 16:02
codemagician13-Nov-02 16:02 
QuestionDoes VB Support recursion? Pin
Like2Byte13-Nov-02 10:05
Like2Byte13-Nov-02 10:05 
AnswerRe: Does VB Support recursion? Pin
Daniel Turini13-Nov-02 10:20
Daniel Turini13-Nov-02 10:20 
GeneralRe: Does VB Support recursion? Pin
Like2Byte13-Nov-02 10:35
Like2Byte13-Nov-02 10:35 
GeneralRe: Does VB Support recursion? Pin
Anonymous13-Nov-02 10:48
Anonymous13-Nov-02 10:48 
GeneralRe: Does VB Support recursion? Pin
Christian Graus13-Nov-02 10:51
protectorChristian Graus13-Nov-02 10:51 
GeneralRe: Does VB Support recursion? Pin
Daniel Turini13-Nov-02 11:13
Daniel Turini13-Nov-02 11:13 
GeneralRe: Does VB Support recursion? Pin
Christian Graus13-Nov-02 11:26
protectorChristian Graus13-Nov-02 11:26 
GeneralRe: Does VB Support recursion? Pin
Ray Cassick13-Nov-02 15:28
Ray Cassick13-Nov-02 15:28 
GeneralRe: Does VB Support recursion? Pin
Christian Graus13-Nov-02 15:38
protectorChristian Graus13-Nov-02 15:38 
GeneralRe: Does VB Support recursion? Pin
Ray Cassick13-Nov-02 15:58
Ray Cassick13-Nov-02 15:58 
GeneralRe: Does VB Support recursion? Pin
David Stone13-Nov-02 16:08
sitebuilderDavid Stone13-Nov-02 16:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.