Help With Coding In Visual Studio Express 2010 Follow

0
Avatar
Legacy Poster

I want to build an App that will print Label(s) so the user never interacts with bartender or even opens it. I currently have a good format or .btw file to work from. All I need on the App is one textbox so user can enter a part number and one textbox for them to enter the number of copies to print. I of course will also need a command button that fires off  the print job. I found this code on a post by other user on the forum , it is exactly what I need except it is VBA code. So my question is will this code work in Visual Studio Express 2010 ?     if not could somebody offer some examples of how the syntax should be, or point me to some other posts or resources that I can look at.  I don't mind putting in the time and effort to learn on my own I just sometimes need a push in the right direction. Thanks


Dim btApp As BarTender.Application

 Dim btQueryPrompt As BarTender.QueryPrompt

 Dim btFormat As BarTender.Format

  Set btApp = New BarTender.Application
 Set btFormat = New BarTender.Format

 btApp.Formats.Open ("N:\UL Label\ul_label.btw")

 btApp.Visible = false
 
btQueryPrompt = btFormat1.Databases.QueryPrompts.GetQueryPrompt(1)
btApp.ActiveFormat.Databases.QueryPrompts.GetQueryPrompt(1).Value = TextBox1.Text 

 btQueryPrompt.UserPrompt = "Enter Part Number:"

 btApp.ActiveFormat.IdenticalCopiesOfLabel = TextBox2.Text 

 

3 comments

0
Avatar
Legacy Poster
Comment actions Permalink

Nevermind ...  after spending quite a bit of time researching and reading I think I have something that is going to work. I just need to add some error checking to make sure textboxes do not get left blank and such.  here is the code I am using in case it might offer some help to someone else who mught be trying something similar.  this was done in Visual Studio express 2010. 


'Declaring  BarTender application variable
        Dim btApp1 As BarTender.Application

        'Declaring BarTender format variable
        Dim btFormat1 As BarTender.Format



        'Instantiating the BarTender object
        btApp1 = New BarTender.Application
        btFormat1 = New BarTender.Format



        'Setting the BarTender format to open
        btApp1.Formats.Open("C:\UL Label\ul_label.btw")



        'Setting the BarTender Application Visible
        btApp1.Visible = False

        btApp1.ActiveFormat.Databases.QueryPrompts.GetQueryPrompt(1).Value = TextBox1.Text
        '

        btApp1.ActiveFormat.IdenticalCopiesOfLabel = TextBox2.Text


        btApp1.ActiveFormat.PrintOut()


        btApp1.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)
0
Avatar
Domingo Rodriguez
Moderator
Comment actions Permalink

Hello Tom,

 

How did it go with the programming?

 

Please notice that you can choose which programming language you're going to use for "Visual Studio Express". There are several installations you can do, such as Visual Basic, C#. In fact, on my PC, I've installed Visual Studio Express 2010 for Visual Basic, C++ and C#

0
Avatar
Duy Phung Duc
Comment actions Permalink

hi ,
using BarTender;

BarTender.Application btApp;
BarTender.Format btFormat;
BarTender.BtPrintResult btPrintRtn;
BarTender.Messages btMsgs;

private void button8_Click(object sender, EventArgs e)
{
btApp = new BarTender.Application();
btFormat = btApp.Formats.Open(@"C:\Users\Administrator\Desktop\TEM_2019.btw", false, "");
btPrintRtn = btFormat.Print(comboBox1.Text, false, -1, out btMsgs);
btFormat.Close(BarTender.BtSaveOptions.btDoNotSaveChanges);
btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);
}

DataTable bang_may_in = new DataTable();
SqlDataAdapter doc_ghi_may_in = new SqlDataAdapter();
private void danh_sach_may_in()
{
// phan quyen quay
bang_may_in = new DataTable();
string lenh = string.Format("select * from may_in");
doc_ghi_may_in = new SqlDataAdapter(lenh, chuoi_lk);
SqlCommandBuilder doc = new SqlCommandBuilder(doc_ghi_may_in);
doc_ghi_may_in.FillSchema(bang_may_in, SchemaType.Mapped);
doc_ghi_may_in.Fill(bang_may_in);
}

Please sign in to leave a comment.