Keynotfoundexception Follow

0
Avatar
Legacy Poster

Hello,

 

Using foreach I print all objects in BarTender format file.

 
foreach (SubString substring in btFormat.SubStrings)
{
                Console.WriteLine("SubString Name: " + substring.Name
                   + ", SubString Type: " + substring.Type
                   + ", SubString Value: " + substring.Value);
}
 
I see object with name: best_before_label
When I try to change the value I with SusString:
 
btFormat.SubStrings["best_before_label"].Value = "Somthing";
 
it throw me KeyNotFoundException.
 
I am sure I have object with this name.
 
Can someone please help me?
 
Thanks in advance
Lachezar Tomov

4 comments

0
Avatar
Domingo Rodriguez
Moderator
Comment actions Permalink

If you open the BarTender document (.btw) manually in BarTender, is the named data source written in low case, or are some letters written in upper case? If some of the letters are upper case, try using the name for the named data source as it appears in BarTender.

 

Does it work correctly if the named data source wouldn't have the underscore (underdash) as part of its name?

 

What exact Edition, version and build of BarTender is in use?

0
Avatar
Legacy Poster
Comment actions Permalink

I use BarTender Enterprise Automation (3 rinters) v10.1

 

My problem is that I have a lot of objects who are merged from several other objects. One merged object has no name so it is not Named Data Source. When I look in System Database I see only object name and value. 

How I can set new value on a object using SDK? As I saw SubString works only with named data sources.

 

Can you tell me please hоw is most propriate way to access the System DB, get object values for a selected label and print that label format?

 

Best Regards

 

Lachezar 

0
Avatar
Domingo Rodriguez
Moderator
Comment actions Permalink

You don't set the variable data for a BarTender object, you do it for the separate data sources it is composed of (by giving the data source a shared name). So if "best_before_label" is not a named data source, you cannot assign a value to it via the "SubStrings.value" property.

0
Avatar
Legacy Poster
Comment actions Permalink

OK, thank you

Please sign in to leave a comment.