|
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' ACD CHEMBASIC DEMO PROGRAM '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' '
' Molecular 3D Editor//MIRROR.BAS '
' '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' '
' The utility flips the molecule at a plane '
' '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
CONST TITLE="ChemBasic Molecular Editor // Mirror"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function Main As String
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' MIRROR.BAS '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim page,diag,asm,struc As Object, s As String, OK As Boolean
MAIN="Failed or nothing to do!"
' Get 1st structure from the curent page
page=ActiveDocument.ActivePage
If page.Diagrams.Count<1 Then Exit Function
diag=page.Diagrams.Item(1)
asm=Assemblies.AddFromCS(diag)
If asm=NULL Then Exit Function
struc=Asm.Structures.Item(1)
If struc=NULL Then Exit Function
' Do the job
s=UserIOBox("Flip X, Y, or Z coordinate ?" ,TITLE , "Y")
s=UCase(Left(s,1))
If s="X" OR s="Y" OR s="Z" Then
' Flip !
Call Flip(struc,s)
' Show the results
RefreshDiagram(diag,struc)
Main="Completed."
End If
End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub Flip(struc As Object,s As String)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim x,y,z As Double, asm,at As Object
With struc
asm=.Assembly
For Each at In asm
.GetAtomXYZ(at,x,y,z)
Select Case s
Case "X"
x=-x
Case "Y"
y=-y
Case "Z"
z=-z
End Select
.SetAtomXYZ(at,x,y,z)
Next at
End With
End Sub
'***LIBRARY PROCEDURES BEGIN
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub RefreshDiagram(diag As Object,strmol As Object)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' LIB0.BAS PROCEDURE '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Redraws the diagram with a molecule or structure object '
' '
' ENTER '
' diag object of type CS_DIAGRAM '
' strmol object of type CB_MOLECULE or CB_STRUCTURE '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim l,t,w,h,w1,h1 As Integer
diag.GetBound(l,t,w,h)
diag.Depict(strmol)
diag.GetBound(w,h,w1,h1)
diag.SetBound(l,t,w1,h1)
End Sub
'***LIBRARY PROCEDURES END
'@@@@@@
someone can help me with this code?!?!?
|
|
|
|
|
OK,
So you've found some code on the internet and posted it here but you haven't asked a specific question describing what it is that you want.
Alan.
|
|
|
|
|
What problem are you having with the code? Can you describe an error message? A few hints would be nice.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
i understand the code but i want develop a chemistry program
|
|
|
|
|
So, do you have a design, specifications, or some idea of what the program should do?
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
in this moment no i hope in your help
|
|
|
|
|
Because we have no clue about your question. Please give us complete details. BTW put your code in Code block in your question which is easy to read.
|
|
|
|
|
Well, if you don't know what the program is supposed to do, I don't think I can figure it out. Let us know what you want it to do and then maybe someone can help figure out how to do it.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
i hope that someone can help me
|
|
|
|
|
i take this code from the chemistry program chemsketch i waant build a dinamic molecula program
|
|
|
|
|
You have already asked this question in both the ASP.NET and C# forums. Unless you come up with some sensible questions, including an outline design of what you are trying to do, then it's unlikely anyone will be able to help you.
The best things in life are not things.
|
|
|
|
|
|
i play with visual c and visual basic but in thin this moment i played only
|
|
|
|
|
In my software I have a function that creates a word documents, saves it to a folder, and prints out the file. The software is working on every computer, but one employee just got a new computer running Windows 7 Professional 64-bit and now the function isn't working solely on her computer. It still creates the word document fine, but it won't show the print dialog. The function is:
Private Sub CreateRecordDocument(ByVal projectNumber As String)
Dim Report As Document
Dim DocBuilder As DocumentBuilder
Dim PrintDB As New PrintDialog
Dim OriginalPrinter As String
Dim NewPrinter As String
Dim wshNetwork As Object
Dim temporaryFileName As String = ExtractReport(projectNumber)
Dim PSettings As New PrinterSettings
Report = New Document(temporaryFileName, LoadFormat.Doc, "")
DocBuilder = New DocumentBuilder(Report)
ReplaceBookmarks(Report, DocBuilder, projectNumber)
Report.Save(temporaryFileName)
OriginalPrinter = PrintDB.PrinterSettings.PrinterName
If PrintDB.ShowDialog() = Windows.Forms.DialogResult.OK Then
PSettings = PrintDB.PrinterSettings
NewPrinter = PrintDB.PrinterSettings.PrinterName
wshNetwork = Microsoft.VisualBasic.CreateObject("WScript.Network")
wshNetwork.SetDefaultPrinter(NewPrinter)
Report.Print(PSettings)
wshNetwork.setDefaultPrinter(OriginalPrinter)
End If
End Sub
Originally I was thinking it wasn't working because of the CreateObject("WScript.Network") but it still should be showing the print dialog and it's not even doing that. Anybody else ever have a problem with the print dialog on Win7 Professional? Any suggestions on how to get this to work on this computer without affecting how it works on XP Professional computers? Thanks in advance for any help with this. It is much appreciated.
|
|
|
|
|
From looking at your code you are failing on one of the following lines:
OriginalPrinter = PrintDB.PrinterSettings.PrinterName
If PrintDB.ShowDialog() = Windows.Forms.DialogResult.OK Then
But if either of these calls fails you are not checking the return values. I would suggest you add some code to check for any error status to see why it is failing.
The best things in life are not things.
|
|
|
|
|
I've added a Try-Catch block around this section of code. The full block now looks like this:
Try
OriginalPrinter = PrintDB.PrinterSettings.PrinterName
If PrintDB.ShowDialog() = Windows.Forms.DialogResult.OK Then
PSettings = PrintDB.PrinterSettings
NewPrinter = PrintDB.PrinterSettings.PrinterName
wshNetwork = Microsoft.VisualBasic.CreateObject("WScript.Network")
wshNetwork.SetDefaultPrinter(NewPrinter)
Report.Print(PSettings)
wshNetwork.setDefaultPrinter(OriginalPrinter)
End If
Catch ex As Exception
MessageBox.Show("An error occurred while trying to print. If this problem persist please contact the system administrator.", "Printing", MessageBoxButtons.OK, MessageBoxIcon.Error)
LogError(ex, "frmMain", "CreateRecordDocument")
End Try
The LogError function writes any errors to the Windows EventViewer. I left the catch block to catch all exceptions because I don't know why this code is not executing. I tried it several times on the Win7 computer it is not working on and all the code previous to this block executes fine, however the document does not print. What is even weirder is that no exception is thrown and nothing is written to the EventViewer. Is there some change with Microsoft.VisualBasic.CreateObject("WScript.Network") between Windows XP and Windows 7, or 32-bit vs. 64-bit. If so, is there a relatively simple work around?
Thanks.
|
|
|
|
|
For reasons known only to yourself you ignored my suggestions about checking return values and put the code inside a Try Catch block. But you already knew that it was not throwing an exception, since any uncaught exceptions would have been handled by the framework. You must check the return values from system calls in order to find out why your code is failing.
The best things in life are not things.
|
|
|
|
|
I hope this explains my problem.
I have two versions of a program, not basically very different, a 'standard' and a 'pro' version that are controlled using compiler directives.
My problem is that the 'standard' version uses one DLL and the 'pro' version uses a different one completely, by a different vendor. Basically zedgraph and spreadsheetgear respectively.
I don't particularly want to send both to both versions of the program but I can't seem to see a method using compiler directives (?) of having one reference for one and the different reference for the other. This also extends to the setup and deployment program as that also seems to only relate back to the project assemblies as far as debug/release are concerned and does not allow for different file sets, or have I missed something?
|
|
|
|
|
You can have references to both DLLs in the same project. The compiler will not add the dependency reference if none of its members are used by your code. So it doesn't create any problem, you see. And regarding Setup & Deployment, you have to create two different setup projects for your Standard and Pro versions.
|
|
|
|
|
Many thanks indeed for that. I did not realise that the reference would not be created if the DLL was not used. Two setups is not a problem. Gave you a 5 for that one!
|
|
|
|
|
Even if any Type in your dependency is used in your code, the assembly is not loaded at the time of starting the process itself; it is loaded only at the point where any of its Type is first used.
|
|
|
|
|
Thanks again. Just one final question, does this also apply to Forms in the project, i.e. if a form is not referenced in code because of the compiler directives it does not get assembled into the exe?
|
|
|
|
|
Yes, it applies to Form class too. As far as the Runtime is concerned, Form is just a Type, it gets no special treatment from the Runtime.
|
|
|
|
|
I have made this database which use ms-access and the data are enter through vb6. On the form the date entered were display as they are entered but on the access table is has changed for example 1 jan 2008, 25 jan, 2008 were display like 01-jan-08 and 25-jan-08 respectively which is okay, but 4 july 2008 happen to be 07-apr-08 and 12 oct 2008 becomes 10 dec 2008. Can any one tell me how some dates gets change in the .mdb file while some doesnot change, and even they are change in the ms-access database file when display them on the form they look still okay as enter.
Would be grateful is anyone throw light on this.
Thank you.
SZ
|
|
|
|
|
It is a long time since I used Access and VB6 but as I recall the dates in the mdb file are always in American format (mm-dd-yyyy). What I don't understand is how 28 Jan 08 remains untouched!
Possibly the problem is that 28 Jan 08 does not have an American equivalent so is forced to what happens to be the correct format. You should set something up to specifically format your dates as you want to see them rather than depend on the built in stuff.
|
|
|
|