Hello everyone and thank you for being such great and helpful community. I am currently working on Visual Basic App (using 10 express version) to print labels by using Brother Printer QL-500. For some reason samples provided by Brother don't work.... any of them and worst part there is no Errors any kind.... now Brother P-Touch Editor 5.1 works and prints fine. I am using b-PAC3 Client Component(64 Bit), running on Windows 7 64 bit. I know some people suggested to target x86 and I did that with no luck its a same thing nothing is happening please see Brother Code I am using below. Thanks!
b-PAC 3.0 Component Sample (Badge)
'
' (C)Copyright Brother Industries, Ltd. 2009
'
'*******************************************************************
Option Explicit On
Public Class Badge
Const sPath = "C:\Program Files\Brother bPAC3 SDK\Templates\Badge.lbx"
'********************************************************
' Open and Print a spcified file.
'********************************************************
Public Sub DoPrint()
Dim bRet As Boolean
Dim ObjDoc As bpac.Document
ObjDoc = CreateObject("bpac.Document")
'Open lbx file
bRet = ObjDoc.Open(sPath)
If (bRet <> False) Then
ObjDoc.GetObject("objName").Text = txtName.Text
ObjDoc.GetObject("objCompany").Text = txtCompany.Text
'objDoc.SetMediaByName(objDoc.Printer.GetMediaName, True)
ObjDoc.StartPrint("", bpac.PrintOptionConstants.bpoDefault)
ObjDoc.PrintOut(1, bpac.PrintOptionConstants.bpoDefault)
ObjDoc.EndPrint()
ObjDoc.Close()
End If
End Sub
Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
DoPrint()
End Sub
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
Me.Close()
End Sub
End Class
After trying to contact Brother technical for 2 weeks resolved nothing still waiting for their response but everything is working now... Not this Badge code but my program if anyone has same issue try installing b-PAC3 Client Component non 64 as well and re-install brother drivers somehow this fixes the issue still wonder what is the problem would be nice to know to avoid it on other systems.
Related
I have a WMP in my vb.net project and I wanted to load the next media automatically after the first is finnished I did some research on googel and found the simple to understand code as per below.
Private Sub AxWindowsMediaPlayer1_PlayStateChange(ByVal sender As System.Object, ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent) Handles AxWindowsMediaPlayer1.PlayStateChange
If AxWindowsMediaPlayer1.playState = WMPLib.WMPPlayState.wmppsStopped Then
AxWindowsMediaPlayer1.URL = ("Test2.mp4")
MessageBox.Show("Playing End")
End If
End Sub
I however cant get it to automatically play the next (Test2.mp4) unless I have the messagebox pop-up. I discovered this purely by accident. However I dont want the Messagebox to pop-up everytime a new Mp4 file is ready to be played. Dose anybody know what is going on here and how I can fix this?
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim oTask01 As Threading.Thread
oTask01 = New Threading.Thread(AddressOf oStarting01)
oTask01.Start()
Dim omessagebox As MessageBox = Nothing
omessagebox.Show("Playing End", "", MessageBoxButtons.OK)
oTask01.Abort()
End Sub
Private Function oStarting01() As Byte
While True
System.Windows.Forms.SendKeys.SendWait(vbCr)
End While
Return 0
End Function
End Class
Hi, try with this code. It works. Diving more deeply in Windows system and subsystems is not an easy task, not at least for me. I hope you get what you were looking for for your software. Thank you very much. Happy codding!. :)
Private Sub AxWindowsMediaPlayer1_PlayStateChange(ByVal sender As
System.Object, ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent)
Handles AxWindowsMediaPlayer1.PlayStateChange
If AxWindowsMediaPlayer1.playState = WMPLib.WMPPlayState.wmppsStopped Then
AxWindowsMediaPlayer1.URL = ("Test2.mp4")
'MessageBox.Show("Playing End") 'This line was commented because is not neccesary in this fragment of code
End If
End Sub
Hi, if I have understood well to you, you wanted to supress the message box. It is got doing a comment's line with "'". I hope you like it and continue enjoying with computers and software. Thank you very much and happy codding. :)
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim SAPI As Object
Select Case TextBox1.Text
Case "1"
PictureBox1.Image = My.Resources.picture1
RichTextBox1.Text = "Information here."
SAPI = CreateObject("SAPI.spvoice")
SAPI.speak(RichTextBox1.Text)
End Select
End Sub
End Class
On two windows 7 machines the pictures and text appear first and then the TTS happens. While on two win10 machines the speech happens first and then the picture and text appear.
I've tried adding a try catch and finally statement and setting up a delay but the problem still persists!
Is there anything I can do to fix this?
Update for blackwood
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim SAPI As Object
Select Case TextBox1.Text
Case "1"
PictureBox1.Image = My.Resources.picture1
RichTextBox1.Text = "Information here."
System.Threading.Thread.Sleep(100)
SAPI = CreateObject("SAPI.spvoice")
SAPI.speak(RichTextBox1.Text)
End Select
End Sub
End Class
Maybe try sticking an Application.DoEvents in there just before the SAPI = CreateObject call. Though it's not the solution, it's the easiest to implement. It'll cause the window get updated (the message loop is handled) before continuing.
If that works, go for the real solution: a background thread or async/await (whenever possible) for the playback of the TTS.
this is my first Q on this website so let me know if I have missed any important details, and thanks in advance.
I have been asked to access a website and download the results from a user-inputted form. The website asks for a username/password and once accepted, several questions which are used to generate several answers.
Since I am unfamiliar with this area I have set up a simple windows form to tinker around with websites and try to pick things up. I have used a webbrowser control and a button to use it to view the website in question.
When I try to view the website through the control, I just get script errors and nothing loads up. I am guessing I am missing certain plug-ins on my form that IE can handle without errors. Is there anyway I can identify what these are and figure out what to do next? I am stumped.
The script errors are:
"Expected identifier, string or number" and
"The value of the property 'setsection' is null or undefined"
Both ask if I want to continue running scripts on the page. But it works in IE and I cannot see why my control is so different. It actually request a username and password which works fine, it is the next step that errors.
I can provide screenies or an extract from the website source html if needed.
Thanks,
Fwiw my code is:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'WebBrowser1.ScriptErrorsSuppressed = True
WebBrowser1.Navigate("http://website.com")
'WebBrowser1.Navigate("http://www.google.com")
End Sub
Thanks for Noseratio I have managed to get somewhere with this.
Even though the errors I was getting seemed to be related to some XML/Java/Whatever functionality going askew it was actually because my webbrowser control was using ie 7.0
I forced it into using ie 9 and all is now well. So, using my above example I basically did something like this:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'WebBrowser1.ScriptErrorsSuppressed = True
BrowserUpdate()
WebBrowser1.Navigate("http://website.com")
'WebBrowser1.Navigate("http://www.google.com")
End Sub
Sub BrowserUpdate()
Try
Dim IEVAlue As String = 9000 ' can be: 9999 , 9000, 8888, 8000, 7000
Dim targetApplication As String = Process.GetCurrentProcess.ToString & ".exe"
Dim localMachine As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine
Dim parentKeyLocation As String = "SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl"
Dim keyName As String = "FEATURE_BROWSER_EMULATION"
Dim subKey As Microsoft.Win32.RegistryKey = localMachine.CreateSubKey(parentKeyLocation & "\" & keyName)
subKey.SetValue(targetApplication, IEVAlue, Microsoft.Win32.RegistryValueKind.DWord)
Catch ex As Exception
'Blah blah here
End Try
End Sub
I am a beginner in learning AT commands and windows programming.
I prepared a code just to read the Serial no of a Nokia phone in VB 2010 as
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SerialPort1.Open()
SerialPort1.WriteLine("AT")
SerialPort1.WriteLine("AT+CNUM")
TextBox1.Text = SerialPort1.ReadLine()
SerialPort1.Close()
End Sub
End Class
Unfortunately, it is not working, no error message.
Port I selected is COM which I verified through device manager. Baud rate set as 9600.
If anybody can help, Please.......
Thanks
0) open read before write,
try switch:
SerialPort1.Open()
TextBox1.Text = SerialPort1.ReadLine()
SerialPort1.WriteLine("AT")
SerialPort1.WriteLine("AT+CNUM")
SerialPort1.Close()
1) send \r (\r\n) -- end of string
2) use command with view resultats:
call (ATD<number>);
busy (ATH);
response call (ATA) -- for view this 2 commands to call from phone to modem;
other (blink/switch off radio/play tone)
disclaimer:
VB don't know, i'm using python on Linux;
sorry for my dirty english.
I'm programming a desktop application similar to Google desktop but with my own gadget with vb.net 2008 how can i make my application when the user install it on their computer to run at the time of start up?
Let assume that my application name is windowsAplication1 and I'm using windows XP and the program will be installed on C drive?
You can add it to registry with the following code
My.Computer.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True).SetValue(Application.ProductName, Application.ExecutablePath)
you can remove it using
My.Computer.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True).DeleteValue(Application.ProductName)
The above code will add it to all users. You can add it to current user in the following key
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
Or you can add a link to your application in the "Startup" folder.
I suggest you dont do it automatically it may irritate the user. I hate when apps add them automatically to Windows Startup. Give an option for the user to run the program on windows startup.
Simpley use this code:
Dim info As New FileInfo(application.startuppath)
info.CopyTo(My.Computer.FileSystem.SpecialDirectories.Programs + "\startup\myapp.exe")
hope it helps.
You Can Do this Using the code below
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' This is where you'll need to have the program
' set the check box to the previous selection that
' the user has set. It's up to you how you do this.
' For now, I'll set it as "unchecked".
CheckBox1.Checked = False
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' The following code is a rendition of one provided by
' Firestarter_75, so he gets the credit here:
Dim applicationName As String = Application.ProductName
Dim applicationPath As String = Application.ExecutablePath
If CheckBox1.Checked Then
Dim regKey As Microsoft.Win32.RegistryKey
regKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
regKey.SetValue(applicationName, """" & applicationPath & """")
regKey.Close()
Else
Dim regKey As Microsoft.Win32.RegistryKey
regKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
regKey.DeleteValue(applicationName, False)
regKey.Close()
End If
' Assuming that you'll run this as a setup form of some sort
' and call it using .ShowDialog, simply close this form to
' return to the main program
Close()
End Sub
Imports Microsoft.Win32
...
Registry.SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", Application.ProductName, Application.ExecutablePath, RegistryValueKind.String)
A simple method
Imports Microsoft.Win32
...
Dim regKey As RegistryKey
regKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run",True)
regKey.SetValue(Application.ProductName, Application.ExecutablePath)
regKey.Close()
Hope it helps
Just try this code :-
FileCopy("Name.Ext", Environment.GetFolderPath(Environment.SpecialFolder.Startup) & "\Name.Ext")
Here (Name.Ext) :-
Name - Your Application's name.
Ext - The Extension, it's of-course .exe
It's the simplest and best to use.
Might be old topic but adding
Imports System.Security.AccessControl.RegistryRights
Should resolve System.Security.SecurityException: 'Requested registry access is not allowed.' trouble stated by Christhofer Natalius