|
If the error says Clipboard is empty, then most likely SendKeys.SendWait("%{Prtsc}") does not always correctly do what is supposed to.
After the SendKeys bit, you could try checking the contents of the clip board first (My.Computer.Clipboard ), to see if the print screen was actually performed, and there is a picture to be pasted. If there isn't you just perform the SendKeys again, until the clipboard contains a picture.
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hi John,
Thanks for replying. The image is there because I can go to paint and paste it.
|
|
|
|
|
Hi, dear all,
I am using VB6. I am running a program created years ago. when I open a form, I got the following error:
Line 75: Property OleObjectBlob in dirDDBox could not be set.
Line 75: Cannot load control dirDDBox; license not found.
Line 83: Property OleObjectBlob in dirListBox could not be set.
Line 83: Cannot load control dirListBox; license not found.
Are dirDDBox and dirListBox shipped with VB6? or belong some other control that need register?
After I run VB6Cli.exe utility, still got the same error.
Can anybody help me. Thanks a lot.
|
|
|
|
|
Are those the names of the variables for instances of those controls? They don't look like the standard controls that ship with VB6. Neither expose a OleObjectBlob property.
|
|
|
|
|
Dave,
I look at the codes again, they should be variables, but I cannot make sure what are the control type of them since I cannot open the form, whenever I open the form, I got the error message.
What should I do in this case?
Thanks!
|
|
|
|
|
Open the file for the form in Notepad. It's just a text file.
|
|
|
|
|
Dave,
Thanks.
the dirDDBox variable is with PTxSCP.PTxShCombo type, and dirListBox is with PTxSCP.PTxShList.
The PTxSCP is third party contril from Plasmatech Software.
I register PTxSCP.ocx, but when I compile the program I got error, Permission denied.
Do you have any idea about this control?
|
|
|
|
|
Never heard of it.
You can reregister the control all you want. What's missing is some license data from the registry that gives you a design-time license so you can create your own apps with it in Visual Studio. I'd dig up the old installers if you can. Otherwise, it's going to be a trip to the vendor to get the fix.
|
|
|
|
|
Dave,
I already reregister the .ocx file, but still has error. I will register the vender's forum to see if I can get any help.
If you have any idea about my question, please tell me.
Thank you very much.
|
|
|
|
|
Dave,
My problem is solved now. I need to run a setup.exe file from Plasmatech to access their control.
Thank you very much for your help.
|
|
|
|
|
I have attached below the code I am using, it works... for the most part, there are 4 drop downs that drive the data, one is independent the "store" drop down, it works fantastically, however the other three dropdowns, are from the same table, it will allow the user to select UPC, SKU, or title, and populate the remaining data. The problem is I want to have the other 2 of the 3 also populate to the selected item. I get an error, if I try to change it after the first time I get the following error.
Column 'TITLE' is constrained to be unique. Value 'System.Data.DataRowView' is already present.
Any help would be greatly appreciated, it has to be something simple, this coded is all in VB 2010.
Thanks
Andrew
'populates store data from store table
Private Sub StoreList1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StoreList1.SelectedIndexChanged
Dim ItemSelected As String
ItemSelected = StoreList1.SelectedValue
Dim stdv As DataView
Dim i As Integer
Dim val(0) As String
Dim st As New bL_vmi_calculatorDataSet._Master___StoreDataTable
stdv = New DataView(st)
stdv.Sort = "Store"
val(0) = ItemSelected
i = stdv.Find(val(0))
RegionTextBox.Text = DataTableReader.Equals(i, 1)
End Sub
'populates titles info from master title list table with TITLE
Private Sub TitleBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TitleBox1.SelectedIndexChanged, TitleBox1.SelectedValueChanged
Dim ItemSelected As String
ItemSelected = TitleBox1.SelectedValue
Dim tldv As DataView
Dim j As Integer
Dim val(1) As String
Dim tl As New bL_vmi_calculatorDataSet.Master_title_listDataTable
tldv = New DataView(tl)
tldv.Sort = "TITLE"
val(1) = ItemSelected
j = tldv.Find(val(1))
PUBLISHERTextBox.Text = DataTableReader.Equals(j, 0)
'UPCbox1.Enabled = False
'SKUBox1.Enabled = False
End Sub
'populates titles info from master title list table with UPC
Private Sub UPCbox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UPCbox1.SelectedIndexChanged
Dim ItemSelected As String
ItemSelected = TitleBox1.SelectedValue
Dim tldv As DataView
Dim j As Integer
Dim val(0) As String
Dim tl As New bL_vmi_calculatorDataSet.Master_title_listDataTable
tldv = New DataView(tl)
tldv.Sort = "UPC (12 Digit)"
val(0) = ItemSelected
j = tldv.Find(val(0))
PUBLISHERTextBox.Text = DataTableReader.Equals(j, 3)
'TitleBox1.Enabled = False
'SKUBox1.Enabled = False
End Sub
'populates titles info from master title list table with SKU
Private Sub SKUBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SKUBox1.SelectedIndexChanged
Dim ItemSelected As String
ItemSelected = TitleBox1.SelectedValue
Dim tldv As DataView
Dim j As Integer
Dim val(2) As String
Dim tl As New bL_vmi_calculatorDataSet.Master_title_listDataTable
tldv = New DataView(tl)
tldv.Sort = "BL SKU"
val(2) = ItemSelected
j = tldv.Find(val(2))
PUBLISHERTextBox.Text = DataTableReader.Equals(j, 1)
'UPCbox1.Enabled = False
'TitleBox1.Enabled = False
End Sub
modified on Tuesday, May 11, 2010 12:14 PM
|
|
|
|
|
Which line exactly produces the error? Is the actual code inside a try catch block?
By the look of the error, it does not happen anywhere in the code that you posted here. More likely in the piece of code that updates the dataview, or adds new rows, or something like that.
My advice is free, and you may get what you paid for.
|
|
|
|
|
It is on the second select, If I select the title, it populates just fine, but when I select another title or UPC or SKU I get the error.
I am fairly positive that its an update issue, so update the data on select?
|
|
|
|
|
The first thing you need to do is move all the code away from the event handlers. In other words, when a selected index changes or something all you want to do is pass the selected value to a global variable.
Create a separate sub with the code (that way you only need to check it one place), and call that sub in the event handlers.
I am not entirely sure, but I have a feeling that the error is caused by creating new datatables and dataviews all the time, instead of adapting a single on.
My advice is free, and you may get what you paid for.
|
|
|
|
|
Works like a champ thanks, I also had to rebind all my fields
|
|
|
|
|
First issue I see...you handled both the SelectedIndexChanged and SelectedValueChanged event for the TitleBox1 control. That means that event will actually fire twice.
Second, you're wasting memory with your array declarations...as in
Dim val(2) As String
That actually creates an array with 3 values, when all you need is one. I understand that you used 0 for one item, 1 for another and 2 for the other, but that's completely unnecessary.
Actually, it's completely unnecessary to have val or ItemSelected. It's a waste of memory. You could just do:
j = tldv.Find(TitleBox1.SelectedValue)
I also don't understand what you're trying to populate PUBLISHERTextBox with. Your comments at the beginning say
for all of the last three methods, but you actually populate it with different columns.
And, I agree with the other responder...you shouldn't be creating new DataViews and repopulating each time.
And his question about where does it occur, meant on which line does the error occur? Yes, you've said it's the second time you do it, but on which line do you get an error the second time?
Also, do you realize that in your SKU and UPC methods, you get your ItemSelected from TitleBox1?
Private Sub SKUBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SKUBox1.SelectedIndexChanged
Dim ItemSelected As String
ItemSelected = TitleBox1.SelectedValue
Is that what you meant to do? Because if you didn't select anything from TitleBox1 the before the others, there will be no value in TitleBox1.
|
|
|
|
|
It works; I will look into streamlining the "memory" used. I have the publisher text, driving everything else as the data is coming from the same source, I don’t want it to look and populate off of another “combo box” field.
My utility is controlled by two tables, the store table that has only the store to select, the other “input” is the title table, and the user can select the SKU, UPC or title to drive that portion.
The next step the program references the sales and inventory data for the store, moth on the selected item and for the total departments QTY or the same category of goods.
I am trying to make this as user friendly and “fool” proof as most of the people using this might have a partial high school education at best.
|
|
|
|
|
Hi everyone,
I have a batch file same as below
SET INSTANCE=%1<br />
SET DatabaseName=%2<br />
SET USR_ID=%3<br />
SET USR_PWD=%4<br />
SET ScriptName=%5<br />
SET OutFile="C:\Output.out"<br />
SQLCMD -S %INSTANCE% -d %DatabaseName% -U %USR_ID% -P %USR_PWD% -i %ScriptName% -o %OutFile&
I would like to run this batch file in my vb application.
Could you please advise me how can I run and pass the arguments to this batch file?
Best Regards,
Orchid
|
|
|
|
|
Load path to bat file and then open this file as a new process.
Dim Location as New Process
Dim myProcess as new Process;
myProcess.Start(Path & ".BAT")
|
|
|
|
|
There are two ways to do this (that I know of):
1. Open the batch file, read through it, edit the text as needed (most elegant solution)
2. Create a new batch file each time and run it (most practical solution)
Finally use Abhinav's trick to launch the bat file.
My advice is free, and you may get what you paid for.
|
|
|
|
|
try this one first:
Process.Start("batchFile.bat", "all the parameters");
and if that does not work, try:
Process.Start("cmd.exe", "/C batchFile.bat all the parameters");
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Thanks a lot for the all answers,
I wrote below codes in my application:
<br />
<code> Dim BatchFile as string ="C:\RunScript.bat"
Dim StrView As String = "C:\Myview.sql"
Dim psi As System.Diagnostics.ProcessStartInfo = New System.Diagnostics.ProcessStartInfo(BatchFile, String.Format("-S {0} -d {1} -U {2} -P {3} -i {4}", txtMachineName.Text, txtSourceDB.Text, txtUserName.Text,txtPassword.Text, StrView ))
Dim proc As System.Diagnostics.Process = New System.Diagnostics.Process()
proc.StartInfo = psi
proc.Start()
When I run the application, all the above codes are executed but when I check the result, it seems that the batch file does not run.
Is there any problem in my code?
Could you please give me an example.
To Luc:
Thanks for reply, but I do not understand exactly what does below code mean?
Process.Start("cmd.exe", "/C batchFile.bat all the parameters");
Could you please give me an example.
Many thanks,
Orchid
|
|
|
|
|
Hi,
you don't need CMD.EXE, my first suggestion works just fine.
you can check whether a batch file runs by including some command that leaves a trail, such as:
- copying a file
- opening some other program (e.g. Notepad)
Here is a C# example that creates 2 files (a text file and a batch file) and runs the batch file:
string batchFile="test.bat";
string textFile="test.txt";
File.WriteAllText(textFile, "Demo text file"+Environment.NewLine+"with dummy text");
File.WriteAllText(batchFile, "Notepad %1");
Process p=new Process();
p.StartInfo=new ProcessStartInfo(batchFile, textFile);
p.StartInfo.CreateNoWindow=true;
p.StartInfo.UseShellExecute=false;
p.Start();
I suggest you translate it to VB and run it!
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Why use the batch file at all?
Why not just use Process.Start to launch SQLCMD directly? Admitedly you will probably have to use the cmd process to launch it, but the batch file is an extra set for no gain.
|
|
|
|
|
Hi, all,
I am using visual basic 6.0. When I run a program created years ago, I got the following error message:
Line 16: Cannot load control SSToolbar; license not found.
SSToolbar is a third party tool.
I don't I really need license for SSToolbar tool or there is some problem in VB.
I search internet, should run VB6Cli.exe to fix license issue for VB5.0, but I am using VB6.0, what should I do?
Thanks!
|
|
|
|
|