|
Richard Deeming wrote: you're a marvellous person
You will find no one on the face of the planet that would agree with that!
Speed of sound - 1100 ft/sec
Speed of light - 186,000 mi/sec
Speed of stupid - instantaneous.
|
|
|
|
|
Hello,
Please help me to solve this problem. I tried to make a code to save a dwg file in pdf form.
These mesag of error belongs to me
AcadPlot: Not defined
AcadPlotConfigurations: type AcadPlotConfigurations no defined
AcPlotScale: AcPlotScale name not declared
Below the code:
Module Mdl_Print
Public Sub PDF_Print()
'Dim AutoCAD As Object
Dim AcadApp As Object
Dim AcadDoc As Object
Dim dirInfo As New DirectoryInfo(Frm_Main.LblFolder1.Text)
Dim fileInfo As FileInfo
Dim AcadApp As AcadApplication = New AcadApplication
AcadApp.Visible = True
AcadApp.WindowState = AcWindowState.acMax
Dim success As Boolean = False
For Each fileInfo In dirInfo.GetFiles("*.dwg") 'dwg for Autocad
AcadDoc = AcadApp.Documents.Open(fileInfo.FullName)
Dim oSS As AcadSelectionSet
oSS = AcadApp.ActiveDocument.SelectionSets.Add("oSS")
oSS.Clear()
Try
Dim ftype(0) As Int16
Dim fdata(0) As Object
ftype(0) = 410 'layout
fdata(0) = "A3 - ENGLISH"
oSS.Select(AcSelect.acSelectionSetAll, , , ftype, fdata)
Dim objPrefFiles As AcadPreferencesFiles
Dim PC3PathOld As String
Dim PC3PathNew As String
Dim PMPPathOld As String
Dim PMPPathNew As String
Dim PtConfigs As AcadPlotConfigurations
Dim PlotConfig As AcadPlotConfiguration
Dim PtObj As AcadPlot
Dim BackPlot As Object
'Set the preferences object
objPrefFiles = AcadDoc.Application.Preferences.Files
'Get the current Printer Config Path (pc3)
PC3PathOld = objPrefFiles.PrinterConfigPath
MessageBox.Show(PC3PathOld, "old Printer Config path (pc3)")
objPrefFiles.PrinterConfigPath = "C:\Users\ROBERT\Documents\Deb + Herve + Will\B - Herve\Technip\Autocad\1st project\OpenExcel\PC3 Files"
PC3PathNew = objPrefFiles.PrinterConfigPath
MessageBox.Show(PC3PathNew, "new Printer Config path (pc3)")
'Get the current Printer Desc Path (pmp)
PMPPathOld = objPrefFiles.PrinterDescPath
MessageBox.Show(PMPPathOld, "Printer Desc Path (pmp)")
objPrefFiles.PrinterDescPath = "C:\Users\ROBERT\Documents\Deb + Herve + Will\B - Herve\Technip\Autocad\1st project\OpenExcel\PMP Files"
PMPPathNew = objPrefFiles.PrinterDescPath
MessageBox.Show(PMPPathNew, "Printer Desc Path (pmp)")
PtObj = AcadDoc.Plot
AcadApp.ActiveDocument.AcPlotType.acExtents()
PtConfigs = AcadDoc.PlotConfigurations
''Add a new plot configuration
PtConfigs.Add("PDF", False)
'
''The plot config you created become active
PlotConfig = PtConfigs.Item("PDF")
''Use this method to set the scale
PlotConfig.StandardScale = AcPlotScale.acScaleToFit
''Updates the plot
PlotConfig.RefreshPlotDeviceInfo()
'Here you specify the pc3 file you want to use
PlotConfig.ConfigName = "Herve.pc3"
'You can select the plot style table here
PlotConfig.StyleSheet = "monochrome.ctb"
'You can select the Scale Line Weight
PlotConfig.ScaleLineweights = True
'Specifies Paper Size
PlotConfig.CanonicalMediaName = "ISO_A4_(210.00_x_297.00_MM)"
'Specifies whether or not to plot using the plot styles
PlotConfig.PlotWithPlotStyles = True
BackPlot = AcadDoc.GetVariable("BACKGROUNDPLOT")
AcadDoc.SetVariable("BACKGROUNDPLOT", 0)
'Updates the plot
PlotConfig.RefreshPlotDeviceInfo()
MessageBox.Show("scale" & PlotConfig.StandardScale)
MessageBox.Show("canonical media name" & PlotConfig.CanonicalMediaName)
MessageBox.Show("config name" & PlotConfig.ConfigName)
MessageBox.Show("plot type" & PlotConfig.PlotType)
MessageBox.Show("scale line weight" & PlotConfig.ScaleLineweights)
'Now you can use the PlotTofile method
If PtObj.PlotToFile(Replace(AcadDoc.FullName, "dwg", "pdf"), PlotConfig.ConfigName) Then
AcadDoc.Utility.Prompt(vbLf + "PDF Was Created")
Else
AcadDoc.Utility.Prompt(vbLf + "PDF Creation Unsuccessful")
End If
'If you wish you can delete the plot configuration you created programmatically, and set the 'BACKGROUNDPLOT' system variable to its original status.
PtConfigs.Item("PDF").Delete()
PlotConfig = Nothing
AcadDoc.SetVariable("BACKGROUNDPLOT", BackPlot)
objPrefFiles.PrinterConfigPath = "C:\Users\ROBERT\AppData\Roaming\Autodesk\AutoCAD 2014\R19.1\enu\Plotters"
objPrefFiles.PrinterDescPath = "C:\Users\ROBERT\AppData\Roaming\Autodesk\AutoCAD 2014\R19.1\enu\Plotters\PMP File"
oSS.Clear()
If AcadDoc.Saved Then
AcadDoc.Close(False)
End If
AcadDoc = Nothing
AcadApp.Quit()
AcadApp = Nothing
success = True
Catch ex As Exception
MsgBox(ex.Message + vbLf + ex.StackTrace)
success = False
End Try
' AcadDoc.Close()
AcadDoc = Nothing
' AcadApp.Quit()
Next
AcadApp.Quit()
End Sub
End Module
|
|
|
|
|
That code looks like VBA (Visual Basic for Applications).
With that you need the Microsoft Visual Basic for Applications module for AutoCAD.
If you are using .NET you have to install the AutoCAD .NET API and convert the code.
|
|
|
|
|
In a vb.net 2012 vb.net desktop application that I am opening for the first time, I am getting the following error and warning message:
Error 1 Resource file "My Project\Resources.resx" cannot be found.
Warning 2 A custom tool 'VbMyResourcesResXFileCodeGenerator' is associated with file 'My Project\Resources.resx', but the output of the custom tool was not found in the project. You may try re-running the custom tool by right-clicking on the file in the Solution Explorer and choosing Run Custom Tool.
I tried to run the custom tool that was suggested in the warning message and that did not help.
Thus can you tell me what I can do to get the Resources.resx file that is missing?
Is there a way that I can paste a screen print of what the visual studio ide is to this post so that you can see it?
|
|
|
|
|
The file is missing. You need to get a copy of it from whoever created the project.
If you can't find a copy of the file, then you'll have to add a new resource file, and re-create all of the resources.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
You mentioned the following ,"If you can't find a copy of the file, then you'll have to add a new resource file, and re-create all of the resources."
There is no resource file. Thus can you tell me how to create the resource file and recreate all the resources? I do not know how to create a resource file and I do not know how to re-create all of the resources. How can I tell what resources need to be added?
|
|
|
|
|
If you have no idea what was in the resources to begin with, there is very little in the code that's going to tell you. Resources are strings, files, icons, images, data, ... that your app uses. There is really no way for you to "figure out" what was in there.
The bottom line is you MUST find the missing file(s).
|
|
|
|
|
Or you could always the many, many things to try that you would have found using a simple google search.
Speed of sound - 1100 ft/sec
Speed of light - 186,000 mi/sec
Speed of stupid - instantaneous.
|
|
|
|
|
in property tab in your project --> Resoursces -->
delete the unused resource
|
|
|
|
|
Im getting error "invalid property array index"..what should i do?
Private Sub Command1_Click()
MsgBox Int(Combo1.ItemData(Combo1.ListIndex))
End Sub
Private Sub Form_Load()
cboBox
End Sub
Private Sub cboBox()
Combo1.AddItem "Number One"
Combo1.ItemData(Combo1.NewIndex) = 0
Combo1.AddItem "Number Two"
Combo1.ItemData(Combo1.NewIndex) = 1
End Sub
My error points here
MsgBox Int(Combo1.ItemData(Combo1.ListIndex))
|
|
|
|
|
This looks like you are just learning - on VB6. VB6 is a dead language and is no longer supported. Download VB.Net express, it is free.
The ONLY reason to be creating new code in VB6 is if you are being forced to support an existing application.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I can't see that a Combobox under VB6 has a Property named "ItemData" - so this is the reason, why it not works.
For what do you think do you need this Property ?
|
|
|
|
|
Looks like it does: ItemData Property[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Debug your code and check the Combo1.ListIndex property. It's probably returning -1 , indicating that there is no item selected.
But as Mycroft said, VB6 is a dead language. Unless you're maintaining an existing product written in VB6, you should be using VB.NET (or C#) instead:
Free IDE and Tools | Visual Studio Community[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I thought this would work fine, loading the entire database table into a list, and then use Linq to grab the matches into another list.
I've never used where and or, this is the first time plus I have contains, thought I got it right.
Dim customers As List(Of model_customer_index) = everything.Where(Function(a) a.FCUSTNO.Contains(pValue) Or a.FCOMPANY.Contains(pValue)).ToList()
If it ain't broke don't fix it
|
|
|
|
|
Case Sensitive? I still have lots to learn about Linq
Dim customers As List(Of model_customer_index) = everything.Where(Function(a) a.FCOMPANY.ToLower().StartsWith(pValue.ToLower()) Or a.FCUSTNO.ToLower().StartsWith(pValue.ToLower())).ToList()
If it ain't broke don't fix it
|
|
|
|
|
jkirkerx wrote: Case Sensitive?
That depends on where you're executing the query, and is one of the more annoying quirks of LINQ.
If you're querying an in-memory list, string comparisons are case-sensitive by default. You can either "normalize" the strings using ToUpper / ToLower (you should prefer upper-case[^], due to the "Turkish I" problem[^]), or you could use IndexOf and pass a case-insensitive StringComparison . (Annoyingly, there isn't an overload of Contains which takes a StringComparison option.)
Passing a StringComparison option is preferable to changing the case, because it doesn't involve creating a new copy of the string.
If you're using a database, your query will use the collation[^] for the column you're querying. Most databases use a case-insensitive collation by default, so your query will be case-insensitive.
If you try to pass a StringComparison when you're querying a database, you'll get an exception telling you that the method can't be converted to a database query.
Not that this is a leaky abstraction or anything!
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Oh that explains why I'm having so much trouble with my string comparisons.
I'll change i to Upper for now and look into String Comparision today.
Thanks Richard!
If it ain't broke don't fix it
|
|
|
|
|
Hi,
i was looking for a snippet to control the line in volume of my machine, but i found nothing usefull!
Could you guys gimme some help?
I am trying to create a simple sound recording software..just to keep busy..
TIA,
Duarte
modified 7-Jan-19 21:02pm.
|
|
|
|
|
|
yes ..i also searched the site but most of examples are C# not Visual Basic..and i do not find anything related to line in also!!
modified 7-Jan-19 21:02pm.
|
|
|
|
|
The example I gave the link to has the Line In volume shown in one of it's pictures so it does contain something to do with Line In.
You can quite easily convert C# to VB, lots of online sites will do it for you, plus you can use the C# modules that do the background work with the audio and use VB to do the UI if you wanted to.
|
|
|
|
|
Alienoiz wrote: but most of examples are C# not Visual Basic Which will always be true so I suggest you learn C#. It's very similar to VB anyway and since most people are using C# over VB, just switch.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I'm not sure what you are searching ...
But ... have you realized that the .Net-Framework has the HScrollBar-Control (or the VScrollBar) which could be used for that.
If this answer doesn't match to your requirement then please provide more information ...
|
|
|
|
|
well..i just want a slider or 2 buttons (+/-) to control the volume of the line in...
the problem is that i find no code for that and i wish to see some snippets so i can understand!!
modified 7-Jan-19 21:02pm.
|
|
|
|