|
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.
|
|
|
|
|
Internally, the dates are not stored in any format. They are a serial number that represents a date/time.
The problem appears to be that whatever code is entering dates into the database is using methods that are no culture-tolerant nor consistant acrossed the code. The common mistake that causes this is using string concatentation to build SQL queries using dates:
' The BAD way...
Dim query As String
query = "INSERT INTO table VALUES (#" & somedatevariable & "#)"
You should be using parameterized queries instead. Use the OleDbParameter class to handle dates and times for you.
You can find a good example of this here[^].
|
|
|
|
|
Hi Dear,
Check your System's Date and Time Settings and make it DD-MM-YYYY, similarly at the time of save date into the access table use the format function like format(dtpicker1.value,"dd-mm-yyyy").
May this helps you...
|
|
|
|
|
Access interprets a date string in American format first. When that fails, it takes a look at the date settings of your computer, and tries again with those settings (or the other way round - I am not sure). Hence, on a non-American computer the outcome is sometimes correct, sometimes wrong.
Parameterized queries - as suggested above - are the solution.
|
|
|
|
|
I got em right now, i had not set right on the form properties, makes changes there and hope it would work fine now. Thank you guys for your time.
zela.
|
|
|
|
|
Hi all,
I need to plot a graph on a Windows forms using numeric values stored in an excel sheet
I came accross this code .. it creates an excel sheet and plot graphs in an excel sheet itself
Public Class testchart
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim objXL As Object
Dim objWbk As Object
Dim oSheet As Object ' Excel Worksheet
Dim oChart As Object ' Excel Chart
objXL = CreateObject("Excel.application")
objWbk = objXL.workbooks.Open("C:\testing\test.xls")
On Error GoTo ErrHandler
Dim iRow As Integer ' Index variable for the current Row
Dim iCol As Integer ' Index variable for the current Row
Const cNumCols = 10 ' Number of points in each Series
Const cNumRows = 2 ' Number of Series
oSheet = objWbk.Worksheets.Item(1)
oChart = oSheet.ChartObjects.Add(50, 40, 300, 200).Chart
oChart.SetSourceData(Source:=oSheet.Range("A1").Resize(cNumRows, cNumCols))
' Make Excel Visible:
objXL.Visible = True
objXL.UserControl = True
ExitHandler:
On Error Resume Next
objWbk = Nothing
objXL.Quit()
objXL = Nothing
Exit Sub
ErrHandler:
MsgBox(Err.Description, vbExclamation)
Resume ExitHandler
End Sub
End Class
Unable to figure out as to how the same graph can be plotted on a windows form using data from excel
Please guide,
Thanks,
Gauti.
|
|
|
|
|
It would be much easier to get the data from the Excel sheet and use something like this[^] to show the chart on your own form.
|
|
|
|
|