vb.net QueryPrompts 关注

0

I need to write a new Software and i have to use existing Labels. The Labels are connected to a Textfile, in the Designer i am able to select the correct row and print the label. But if i try to select a Label from dotnet:

Dim path As String = "C:\CS\Firma\Projekte\Softwerk\Neuhofer\Files"
Dim LabelName As String = "BND-COM-BundFUR.btw"
Dim File As String = IO.Path.Combine(path, LabelName)

Dim btFormat As LabelFormatDocument = engine.Documents.Open(File)
btFormat.DatabaseConnections.QueryPrompts(0).Value = "9003719142925"

btFormat.ExportImageToFile("C:\temp\temp\bt\test.jpg", ImageType.PNG, ColorDepth.ColorDepth256, New Resolution(96), OverwriteOptions.Overwrite)

It didn't search for the correct row in the Database, i always get the "default" label from the designer.

What i am doing wrong?

6 评论

0
Avatar
Peter Thane
评论操作 固定链接

I think the issue is you are not declaring the name of the query prompt correctly. This old forum post may help

https://support.seagullscientific.com/hc/en-us/community/posts/216561527-Query-Prompt-Vb-net

0
Avatar
Wolfgang Bornatowicz
评论操作 固定链接

Hi Pete,

 

thanks for the answer.

What can be wrong if i use the index 0? I just have 1 query prompt and i see the index 0 in the collection?

btFormat.DatabaseConnections.QueryPrompts(0).Value

Thanks

Wolfgang

0
Avatar
Peter Thane
评论操作 固定链接

From Ian's earlier answer it looks like it should be specified like the below where you actually declare the name of the query prompt and sets its value:

btFormat.DatabaseConnections.QueryPrompts("Nutrition Calorie Data").Value = "40 Calories"

If you haven't renamed the Query Prompt then it would be called "QueryPrompt1" I believe by default. 

0
Avatar
Wolfgang Bornatowicz
评论操作 固定链接

Even if i use 
btFormat.DatabaseConnections.QueryPrompts("Abfrage-Eingabe1").Value = "9003719142925"
it didn't give me the expected label

0
Avatar
Peter Thane
评论操作 固定链接

I just noticed the export image command. As there is no print command I believe BarTender is therefore not processing the record selection and so the image you are getting will be the same one you would see when you open BarTender (ie the first record in the database only) 

0
Avatar
Wolfgang Bornatowicz
评论操作 固定链接

OK, after research i try it with the print command, but than it would print about 2000 pages, not only one. This is my current, simple code:

Dim path As String = "C:\CS\Firma\Projekte\Softwerk\Neuhofer\Files"
Dim LabelName As String = "BND-COM-Bund_DOW14.btw"
Dim File As String = IO.Path.Combine(path, LabelName)

Dim btFormat As LabelFormatDocument = engine.Documents.Open(File)

btFormat.Activate()
btFormat.DatabaseConnections.QueryPrompts(0).Value = "999999999"
Dim r As Result = btFormat.Print("Test")

999999999 is unique in the csv. What could be wrong?

请先登录再写评论。