|
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!
|
|
|
|
|
without knowing anything about SSToolbar you may not need a license for SSToolbar, but SSToolbar may need a license for something else...like a particular version of Windows or a particular version of Office.
Hopefully someone on here actually knows the product.
|
|
|
|
|
|
Thanks all.
I also see this link, but I am confused.
I am using VB 6.0, do I need to run VB6Cli.exe? Somebody said VB6Cli.exe is shipped with VB6.0, is it right?
|
|
|
|
|
|
Dave,
So you think I should run that exe file?
|
|
|
|
|
Well, unless you find another solution, you have nothing to loose!
Although, it is your choice, and i am not taking any responsibility!
The file is direct from microsofts website, so not as if it is being downloaded from some random website.
The other option is to reinstall vb6 (probably an in place over install).
|
|
|
|
|
Dave,
Thank you very much.
|
|
|
|
|
Hi, Dave,
I run that exe file, but when I run the program again, I still get the same error.
License information for this component not found. You do not have an appropriate license to use this functionality in the design environment.
What else should I do?
Thanks!
|
|
|
|
|
I can't remember if SSToolbar was a control that shipped with VB6 or not? i don't keep VB6 installed anywhere now, so can't go and check.
Can you go to the DLL in explorer and look at the file info and see who the company is that wrote it. Then it might be just a case of some more google searches until a solution found. Might need to get hands on the original DLL installer, to get the license file.
|
|
|
|
|
I don't think SSToolbar shipped with VB6. AFAIR it was a free 3rd party control. Similarly to the OP, I don't think SSToolbar requires a license.
I would try to remove it from the form, add it again and recompile.
It could, however, be that the control needs to be properly installed in VB6, and from what I gather, you don't have the installation file, only the distributed ocx, right?
modified on Tuesday, May 11, 2010 7:14 AM
|
|
|
|
|
Hi, Thanks for reply.
SSToolBar is not shippped with VB6, it's a third party too.
After I unregister it and then re-register it again, the above error message gone, but still in the same line, I got the following error:
Run-time error '429':
License information for this component not found. You do not have an appropriate license to use this functionality in the design environment.
I thought it may not really the license issue, should be something in VB part.
How's your thinking.
Thanks!
|
|
|
|
|
It definitely sounds to me like the control should be properly installed in VB6 using the installer for the component, but as I said earlier: I guess you haven't got access to that?
|
|
|
|
|
John,
This project was created years ago by other people. I also install it in my computer, everything is fine. But when I got the source codes and try to run it from VB6, I got this error.
|
|
|
|
|
Have you tried this:
http://support.microsoft.com/kb/194751/en-us[^]
???
[EDIT: OK, sorry - I see from previous posts that you have... - sorry for mentioning it again...]
I don't think it's going to fix the problem, but it's worth a shot...
I seem to recall that there should be another tool/fix that does something similar to some other components, but I haven't located it yet...
And for those moderately interested in what controls are included in VB6, I found this link:
http://support.microsoft.com/kb/194784/EN-US/[^]
modified on Tuesday, May 11, 2010 10:29 AM
|
|
|
|
|