|
Hi, EveryBody,
I want to display pictures stored in a database. First I use the following code(VB6) to save the picture to the database:
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim stream As New ADODB.stream
Set cnn = New Connection
cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=H:\test.mdb;"
cnn.CursorLocation = adUseClient
cnn.Open
Set rst = New Recordset
rst.ActiveConnection = cnn
rst.Open "t1", cnn, adOpenKeyset, adLockOptimistic
rst.AddNew
rst!p_name = "dd"
stream.Type = adTypeBinary
stream.Open
stream.LoadFromFile "H:\pp.jpg"
rst!pic = stream.Read
Set stream = Nothing
rst.Update
cnn.Close
------------------------------
and then I use the following code(ASP) to display the image:
<%
Dim cnn
Dim rs
' Clear existing HTTP header info
Response.Expires = 0
Response.Buffer = TRUE
Response.Clear
' Set the HTTP header to an image type.
Response.ContentType = "image/JPEG"
cnnPubs=getdbconn() ' the function return the db connection
set rs=server.CreateObject("adodb.recordset")
rs.Open "SELECT FROM t1where id=1",cnn
Response.BinaryWrite rst("pic")
Response.End
%>
and I use to show the image.
the first(vb) code works well.
but I alway can not display the image, I just got a image like red X.
please help me to solve the problem.
Thanks a lot!!!
Best!
Alan
|
|
|
|
|
I have to be produce a zoomed in image of a picture that is displayed. in a seperate box to the reg size image. I have the cooords and dimensions of the area that I want, but I cannot figure out how to either extract part of the image or simply copy the image and then zoom in.
This is the AxImgEditLibCtl that I am referring to. I tried to create a graphics object, and use the methods that it provides, but because the initial image that I am using is a .tif like file there is a number of images contained within it, and therefore the graphics class doesn't work (I have tested with simple gif and jpegs and it does work)
If anyone has worked with this class before I would appreciate some input because I have tried for way too long and have only gone in circles.
Thanks
|
|
|
|
|
It would be cool if I cold some how obtain an image or bitmap of the picture that is currently being displayed
|
|
|
|
|
I have a VB6 program that needs to reference the Microsoft Outlook 9.0 Object Library since it will be running on a machine the still uses Office 2000. The machine I want to compile the program under uses Office 2003 which uses the Microsoft Outlook 11.0 Object Library. When compiled under this machine it will not run on the Office 2000 machine because it cannot find the object. Is there a way that I can ad a reference in VB6 to the 9.0 Object library? I can compile under a 2000 machine but I want to avoid that if possible. Thanks!
"It has become appallingly obvious that our technology has exceeded our humanity."
- Albert Einstein (1879-1955)
"I think there is a world market for maybe five computers."
- Thomas Watson (1874-1956), Chairman of IBM, 1943
"640K ought to be enough for anybody."
- Bill Gates (1955-), in 1981
"Half this game is ninety percent mental."
- Yogi Berra
|
|
|
|
|
You cna't do it unless the machine you compile the app on actually has Office 2000 on it. Any machine your app runs on would need Office 2000 on it. You referencing any version of the library will not give your app the ability to use any version of Office. The machine MUST have the version of Office that you compiled against.
RageInTheMachine9532
|
|
|
|
|
I had this same problem with using the WORD and EXCEL object libraries. The following example I'll use is with WORD, but you can modify it for your own project.
Dim wA as Object<br />
Dim WordWasNotRunning as Boolean<br />
<br />
Sub Test()<br />
On Error Resume Next<br />
Set wA = GetObject(, "Word.Application")<br />
If Err Then<br />
Set wA = CreateObject("Word.Application")<br />
WordWasNotRunning = True<br />
End If<br />
On Error Goto 0<br />
<br />
<<Insert Code Here>><br />
<br />
If WordWasNotRunning then wA.Quit<br />
Set wa = Nothing<br />
End Sub
This code creates an object and then by using the GetObject/CreateObject opens whichever object library is installed on the machine. The boolean is so that you do not close the Word application if they already had it opened with another document, if you don't do it this way, then you will leave multiple WinWord.exe processes running on the machine and your program will crash after you have initialized it at least once. (MAKE SURE YOU DESTROY THE OBJECTS!!)
HINT:
Design your program first by loading the object libraries for Office so you can debug the program and get the helpful dropdown menus. Then before you compile it, change the code to the code on top and get rid of the library References. I also found out that older versions of office do not use the same constants (i.e. wdStory, etc.), so use the actual values like '6'. Hope that helps.
-Garrett
|
|
|
|
|
Yeah thanks...I found that the CreateObject lets me do "late binding" so that I can reference whatever object library is installed on the machine. I'm not at work so I can't post my code but when I get back on Mon. I may post a little of it. The Outlook object lets my reference folders such as my inbox with numbers like 6 (which is my inbox on my machine) and it compiles and runs fine on my machine that runs Office 2003 without having to reference the outlook obj library. Then I emailed the exe to the guy that sits behind me who runs Office 2000 and when he ran it, it threw a run-time error. I think it has to do with the 6. I tried something like olFolderInbox but then it wouldnt build. I'll have to post some code...
"It has become appallingly obvious that our technology has exceeded our humanity."
- Albert Einstein (1879-1955)
"I think there is a world market for maybe five computers."
- Thomas Watson (1874-1956), Chairman of IBM, 1943
"640K ought to be enough for anybody."
- Bill Gates (1955-), in 1981
"Half this game is ninety percent mental."
- Yogi Berra
|
|
|
|
|
I have a String being sent to an Excel spreadsheet through a VB.NET application. The string is loaded from a database. An example is "00001".
I export the data to Excel using the following code:
mExcelApp.Worksheets(1).Range("A1:A1").Value = "00001"
But everytime it formats it as an integer so it becomes "1".
How can I change it?
Also, is there a statement to autosize column widths...?
HELP ME!
Any good web-sites on this?
Thanks in advance.
Regards,
Erik J. Long
|
|
|
|
|
You could either change the Format of the cell to Text or send the string with a single quote prefixed to it:
mExcelApp.Worksheets(1).Range("A1:A1").Value = "'00001"
RageInTheMachine9532
|
|
|
|
|
[In reply to your other posting...]
As is often the case, Dave beat me to the punch. I was gonna say the same thing, dammit.
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
RageInTheMachine9532
|
|
|
|
|
The cells in Excel are by default set to General and Excel formats them based on what it thinks you have entered in the cell, in this case any number padded with leading zeroes will be reduced. You can change the format of the cell in code with:
MyExcel.MyWorksheet.Cells(1,1).Numberformat="@"
However, when I've done this it caused a strange display problem when the text was very long. Another way to force it to display as you type is to put an apostrophe "'" before the text. The apostrophe won't appear in the cell's display but will in the fx bar across the top.
There is an AutoSize column width method but the syntax escapes me for the moment. Whenever doing anything with Word or Excel, record a macro of you doing it manually. This can be found in Excel in Tools->Macro->Record Macro. It will show you the syntax of any command you have performed.
Hope this helps.
|
|
|
|
|
Hi there guys.
Have a little problem. I need to search through a Word doc, and highlight all occurrences of what we are calling "tagged fields". A tagged field is in the format <<sometext>> (eg. <<name>> or <<addr1>>
Am having a problem with getting word to find these fields. If I search for "^50^50" (<<), then it finds OK, ditto "^52^52"(>>), and if there is a single char between the tags, the ^50^50^$^52^52 works fine. Unfortunately, the text may be of different lengths. Aha - can use the * wildcard! Unfortunately not....when attempting ^50^50*^52^52, keeps telling me that invalid pattern match is being used, since need to explicitly use wildcard matching.
Any ideas anyone?
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
S'ok - cracked it....just use an escape char '\', so to find my fields, I have used
\<\<*\>\>
with wildcards turned on.
Simple really!
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
I've been trying to use the databinding directly to an ADO recordset. Everything works ok except if someone else changes a Record in the source, the DataCombo/list do not see the change. Same if a record is added or deleted. How would I program this to see any changes/Additions? My programs are all shared, using a Database on a server.
|
|
|
|
|
The database your using would have to support sending back notifications of changes so you could refresh your Dataset. SQL Server supports this as an additional install on the server, but Access doesn't.
RageInTheMachine9532
|
|
|
|
|
Thanks, I kinda thought that was the case. I was just trying Databinding as a different way of doing it. I've been doing the data accessing direct and coding my own interfacing. I can't do that very well in the .Net. Thanks a lot for the Info.
|
|
|
|
|
I am trying to figure out how to hook this DocumentBeforeSave event when using IDTExtensibility2( Add-in
for all office application )got this idea from ms knowledge base Q238228
I worked with "Using the VB6 Add-in Designer", but not with "COM Add-In Using Implements"
Dim WithEvents objWord As Word.Application
Private Sub objWord_DocumentBeforeSave(ByVal Doc As Word.Document, SaveAsUI As Boolean, Cancel As Boolean)
msgbox "please say something!!!"
End Sub
Thanks in advance
Shin
|
|
|
|
|
|
I am aware of System.IO.Path.InvalidPathChars. However, I don't know how to filter out these characters when input into a text control. I tried using the TextBox1.KeyDown event, but I don't know how to keep the invalid char from showing up in the textbox, even if I can identify it.
Mark Kettlewell
|
|
|
|
|
Hi,
I am stuck when try to detect an user deleting a row of a datagrid table! I do need to perform some tasks at that moment, but so far I can't!
*) I did try to set datagrid events KeyPress, KeyDown, KeyUp but somehow no event generated when I success delete a datagrid row!
Can someone explain or show me how to set this kind of event?
Thank for any help!
|
|
|
|
|
Just get an event on the form and see there is a change on the number of rows in the datagrid. Work?
Shin
|
|
|
|
|
Hi Shinay,
This way is worked, except that I have to do two steps.
Thanks
|
|
|
|
|
I am receiving this error when trying to open an oledb connection on an Excel file from within VB.NET. All samples I have seen seem straight forward but for some reason I cannot connect to the file. My Connection string is "Provider=Microsoft.Jet.Oledb.4.0;Datasource=c:\file.xls;Extended Properties=Excel 8.0;HDR=Yes".
I have attempted to manipulate my connection string with different properties with no luck. If anyone has any suggestions as to what is wrong please let me know.
|
|
|
|
|
I have a dialog with a treeview and a listview. I want the listview to change when i select a different node on the treeview (I use the AfterSelect event of the treeview) - before I show the dialog using dlg.ShowDialog() I want to populate the treeview and then in the code select the a treeview node to fire the AfterSelect event which will populate the listview then I want to programatically select some items in the listview.
The problem is that the AfterSelect event doesn't seem to get fired until the dlg is shown so if I do
<br />
call dlg.PopulateTreeView()<br />
call dlg.SelectListViewItems()<br />
dlg.ShowDialog()<br />
the listview isn't populated when I call dlg.SelectListViewItems
Is there a well known way of doing this?
Rugby League: The Greatest Game Of All.
|
|
|
|