|
..and what is the problem with the code? Does it throw an exception? If yes, what does the exception say?
Bastard Programmer from Hell
|
|
|
|
|
It throwing an exception that:
in valid argument tb1
cat.Tables.Append(tbl)
while appending the table
|
|
|
|
|
Ah, you could have guessed that the error would be important. I haven't used DBaseIV in a few centuries, and I can't test your code; however, I guess that the table doesn't exist in the target-database.
Create the table by hand, run the code again. If it works, you'll need to write some code to create the table.
Bastard Programmer from Hell
|
|
|
|
|
I've googled, searched CodeProject, etc, and I hope I'm overlooking something, but here is what I want to do:
I want to call a Windows Form application from another Windows Form application.
The program being called, may be called from different form based applications and needs to know who is calling.
I've found in testing, that with this code, I can accept a parameter:
Public Shared Sub Main() <br />
If Command$() = "/CR" Then<br />
strAppStartedFrom = "CR" 'Started from Check Recon Application<br />
Else<br />
strAppStartedFrom = "--"<br />
End If<br />
MsgBox(strAppStartedFrom & Command$())<br />
frmFTP.ShowDialog()<br />
End Sub<br />
I've published it, and from what I can find it puts the exe in this location?
C:\Users\username\AppData\Local\Apps\2.0\0BTCBQ53.QL1\OMCV071R.O93\carr..tion_c302ad764aefaa28_0001.0001_bcaadc20b696e727\CarrollFlexFTP.exe /CR
This path seems like it might change and not be consistent when installing it for different users.
The above link works if it is executed with a /CR parameter, but I need a more stable way of doing this.
In the past I've pointed shortcuts to the setup.exe file in the location we publish the application to, but if I run the app using the setup.exe /CR parameter, it doesn't work.
Suggestions?
Lost in the vast sea of .NET
|
|
|
|
|
It appears that you're using ClickOnce deployment. If you want a more stable path, then you can't use ClickOnce Deployment. You have no control over the path that the app is installed to.
KreativeKai wrote: The above link works if it is executed with a /CR parameter, but I need a more
stable way of doing this.
What do you mean by this? Your code is just looking for a command line switch. It shouldn't care about the path that the thing was launched from.
KreativeKai wrote: In the past I've pointed shortcuts to the setup.exe file in the location we
publish the application to, but if I run the app using the setup.exe /CR
parameter, it doesn't work.
Why are you putting the /CR on the Setup.exe command line?? You didn't write Setup.exe and it won't pass on parameters, so what's the point here??
|
|
|
|
|
We are using clickonce deployment and yes, I agree this limits control. Setup.exe is not passing the parms, and like you said it basically shouldn't. The only exe that I have found to read the parms passed is when I use the random address they create on the fly.
Frustrating... The clickonce deployment gives you so many advantages but in turn takes the flexibility out of the process.
Oh well, I've already started coding the first app to call the second app, and I'll have to write and read a file to pass the information between the two and also keep the clickonce setup intact.
Thanks as always for your input...
Lost in the vast sea of .NET
|
|
|
|
|
KreativeKai wrote: The only exe that I have found to read the parms passed is when I use the
random address they create on the fly.
Why are you even concerned about the path ClickOnce uses at all?? Are you saying that you have two applications where one launches the second and passes command line args?? ClickOnce was not designed for that at all. It was designed for simpler, single applications only. I suggest you don't use it at all because your requirements have outgrown the capabilities of ClickOnce.
If you package your applications using traditional MSI installers, your apps get installed under Program Files and you control the names of the folders used under that.
BTW, Command$ is the old VB6 way of doing it. VB.NET uses something more standardized:
Public Sub Main(ByVal args() As String)
You get the command line arguments already parsed for you in an array of strings.
|
|
|
|
|
Thanks for the BTW about the VB6 code... I found it on google and didn't realize.
I agree, my requirements have outgrown the capabilities of ClickOnce...
You asked:
Why are you even concerned about the path ClickOnce uses at all??
Basically what I found was if I pass the /CR parm into the app using:
1) The long random ClickOnce path - It works
2) The shortcut ...appref-ms /CR - It doesn't work
3) Published path setup.exe /CR - It doesn't work, and you explained this earlier, which makes sense why it does not...
4) Published path appname.application /CR - It doesn't work, and is probably for the same reason that setup.exe doesn't work.
All four ways start the program, but only #1 recognizes the parm? This is where my confusion is.
I'm just confused as to if I get the command line code working, which way can I execute the application.... or maybe command line parameters are best used when the application is not click once, which is sort of what you mentioned in an earlier thread.
Thanks for all your help so far, and hopefully this will clarify my confusion.
Lost in the vast sea of .NET
|
|
|
|
|
You have to learn why things work in Windows as well as how.
1) It works because you told Windows where to find the .exe you want to launch.
2) Shortcuts do not pass parameters to the command lines they launch.
In order for you to just click Start -> Run and type your app name, hit Enter and it launches, you have to include the path to your .EXE file in the PATH environment variable. (This is something inherited from the old DOS days.) You can't do that from ClickOnce AFAIK. You have to do it using a traditional MSI installer.
Good Luck!
|
|
|
|
|
I enjoyed the "old DOS days" and still have several DOS manuals on my bookshelf that come in handy once in a while. My problem is that my job responsibilities are 90% COBOL code and mainframe programming and only 10% of the time I can code in Visual Studio. When I do get a chance to work in VB, it sometimes becomes more trial and error.
Thanks for your help and enjoy your weekend!
Lost in the vast sea of .NET
|
|
|
|
|
I am not sure if this helps you, but I did find a way to accept parameters when launching a clickonce application. I activated the app by creating a new process using the uri to to the *.application file appending my arguments in the query string.
I am using VB10, I don't know if it will be the same for you if you are using something different.
From My Project -> Publish (tab) -> Options (button) -> Manifests
"Block application from being activated via a URL" should be UNchecked
"Allow URL parameters to be passed to application" should be checked
After you publish like that you can launch the other app by url including a query string (http://MyDomain.com/MyFolder/MyApp.application?MyParamValueA=1&MyParamValueB=2):
When the application is launched this way the query string arguments will not appear with the regular command line arguments, but instead need to be pulled from .Net like this (make sure you add null checks):
System.AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData(0)
|
|
|
|
|
I have made a program that calls itself.
I must pass the command line to it, but the program must know in with state it is. (first call or the second on)
I think i found the ideal solution for this problem.
The global atom database!
<pre lang="vb">
Private sub main()
Nta = FndAtom("AdminRunStatus")
If Nta = 0 Then
Nta = SetAtom("AdminRunStatus")
'set the status for the second run
'do something for the first run (shell to myself)
call shell (App.Path & "\" & App.EXEName & " " & Command)
End If
Exit Sub
Else
Call DelAtom(Nta)
'second program and the command line
call shell(Second program & " " & Command)
'do something for the second run.
End sub
This my created wrapper for the atom database:
Option Explicit
Private Declare Function InitAtomTable Lib "kernel32" (ByVal nSize As Long) As Long
Private Declare Function AddAtom Lib "kernel32" Alias "AddAtomA" (ByVal lpString As String) As Integer
Private Declare Function DeleteAtom Lib "kernel32" (ByVal nAtom As Integer) As Integer
Private Declare Function FindAtom Lib "kernel32" Alias "FindAtomA" (ByVal lpString As String) As Integer
Private Declare Function GetAtomName Lib "kernel32" Alias "GetAtomNameA" (ByVal nAtom As Integer, ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Declare Function GlobalAddAtom Lib "kernel32" Alias "GlobalAddAtomA" (ByVal lpString As String) As Integer
Private Declare Function GlobalDeleteAtom Lib "kernel32" (ByVal nAtom As Integer) As Integer
Private Declare Function GlobalFindAtom Lib "kernel32" Alias "GlobalFindAtomA" (ByVal lpString As String) As Integer
Private Declare Function GlobalGetAtomName Lib "kernel32" Alias "GlobalGetAtomNameA" (ByVal nAtom As Integer, ByVal lpBuffer As String, ByVal nSize As Long) As Long
Public Function SetAtom(ByVal AtomStr As String) As Integer
SetAtom = GlobalAddAtom(AtomStr)
End Function
Public Function GetAtom(ByVal Atom As Integer) As String
Dim buFfer As String
Dim lRet As Long
buFfer = String(255, 0)
lRet = GlobalGetAtomName(Atom, buFfer, Len(buFfer))
If lRet > 0 Then
buFfer = Left$(buFfer, lRet)
GetAtom = buFfer
Else
GetAtom = vbNullString
End If
End Function
Public Function DelAtom(ByVal Atom As Integer) As Integer
DelAtom = GlobalDeleteAtom(Atom)
End Function
Public Function LocDelAtom(ByVal Atom As Integer) As Integer
LocDelAtom = DeleteAtom(Atom)
End Function
Public Function LocSetAtom(ByVal Atom As String) As Integer
LocSetAtom = AddAtom(Atom)
End Function
Public Function LocGetAtom(ByVal Atom As Integer) As String
Dim buFfer As String
Dim lRet As Long
buFfer = String(255, 0)
lRet = GetAtomName(Atom, buFfer, Len(buFfer))
If lRet > 0 Then
buFfer = Left$(buFfer, lRet)
LocGetAtom = buFfer
Else
LocGetAtom = vbNullString
End If
End Function
Public Function LocFndAtom(ByVal AtomStr As String) As Integer
LocFndAtom = FindAtom(AtomStr)
End Function
Public Function FndAtom(ByVal AtomStr As String) As Integer
FndAtom = GlobalFindAtom(AtomStr)
End Function
Public Function LocInitAtom(nSize As Long) As Long
LocInitAtom = InitAtomTable(nSize)
End Function
|
|
|
|
|
Hi !
How can i use The Drag and drop to swap two labels
Omar Benchhiba
modified 7-Mar-22 21:01pm.
|
|
|
|
|
|
|
I've browsed through dozens of posts on this subject, tried downloading some sample databases of which none worked, and tried to paste some codes into my test project, but I've not been able to figure out how to get a currency conversion value into my textbox.
Can anyone try to explain to me in a simple step by step process how to do the following:
My "form1" form has a button "button1" and two text boxes: "textbox1" contains the start currency value (e.g. in USD) and "textbox2" should display upon clicking the button1, the corresponding value in EUR.
I've added a Service Reference to my project with website: "http://www.webservicex.net/CurrencyConvertor.asmx"
Any assistance is highly appreciated. Once I can do one value, I can modify it to whatever I want.
Thanks!
Wouter
|
|
|
|
|
Dim conversionRate As Double = 0.0
Dim currencyService As New CurrencyConvertorSoapClient("CurrencyConvertorSoap")
conversionRate = currencyService.ConversionRate(Currency.USD, Currency.EUR)
Console.WriteLine("The conversion rate for USD to EUR is: {0}", conversionRate)
Console.WriteLine("$100.00 = {0} Euros", 100 * conversionRate)
Why was this so hard?? The only thing I can see that would be that hang up is the name of the endpoint ("CurrencyConvertorSoap"), which can be obtained by looking in your app.config file under <system.servicemodel><bindings>.
|
|
|
|
|
I got an error and i have tried so many ways to solve it..but still got error..
my table have 3 columns.. SID(autonumber), movieid(text),seat(text)..
i want to store splitword(1) into movie ID and for the rest splitword(i) where i = 3 , 4 ,5 6 and so on..... store in seat columns with new row..
sorry for bad english..
this is my code:
Dim index As Integer = 2
Dim testsplit As String = "Book 9 j18 d7 d8 a9"
Dim SplitWord() As String = testsplit.Split(" ")
Dim wc As Integer = SplitWord.Length - 1
Do While index <= wc
SeatNewRow.Item("MovieID") = SplitWord(1)
SeatNewRow.Item("Seat") = SplitWord(index)
SeatDS.Tables("Seat").Rows.Add(SeatNewRow)
index += 1
Loop
SeatDA.Update(SeatDS, "Seat")
modified 9-May-12 13:20pm.
|
|
|
|
|
Your code isn't adding new rows, you're modifying existing rows. Well, at least the code you posted. We can't see the code where you create this new row. Where is SeatNewRow being created??
|
|
|
|
|
actually this is only some part of the code..
I have table name Seat..in the table have 3 columns named SID, MovieID and Seat.
Actually i want to save the the word to the tables..
Splitword(1) to the MovieID column..
Splitword(2),splitword(3) and so on in the column "seat" with same value Splitword(1) on movieID.
The code as below..but i got "This row is already belongs to this table"..so, what should i do??
Dim SeatNewRow As DataRow
Dim index As Integer = 2
Dim testsplit As String = "Book 9 j18 d7 d8 a9"
Dim SplitWord() As String = testsplit.Split(" ")
SeatNewRow = SeatDS.Tables("Seat").NewRow()
Dim wc As Integer = SplitWord.Length - 1
Do While index <= wc
SeatNewRow.Item("MovieID") = SplitWord(1)
SeatNewRow.Item("Seat") = SplitWord(index)
SeatDS.Tables("Seat").Rows.Add(SeatNewRow)
index += 1
Loop
SeatDA.Update(SeatDS, "Seat")
..
|
|
|
|
|
You have to put the call to .NewRow() INSIDE the Do While loop, not outside of it. You have to create a new row object for every row you add. You cannot reuse the same object for the reason the error message gave you. You already added it!
|
|
|
|
|
So it is i need modified my code as below???i will try it now..
Dim SeatNewRow As DataRow
Dim index As Integer = 2
Dim testsplit As String = "Book 9 j18 d7 d8 a9"
Dim SplitWord() As String = testsplit.Split(" ")
Dim wc As Integer = SplitWord.Length - 1
Do While index <= wc
SeatNewRow.Item("MovieID") = SplitWord(1)
SeatNewRow.Item("Seat") = SplitWord(index)
SeatNewRow = SeatDS.Tables("Seat").NewRow()
SeatDS.Tables("Seat").Rows.Add(SeatNewRow)
index += 1
Loop
SeatDA.Update(SeatDS, "Seat")
|
|
|
|
|
problem solved....thanx so much...!!!
the solved code is as below:
Dim SeatNewRow As DataRow
Dim index As Integer = 2
Dim testsplit As String = "Book 9 j18 d7 d8 a9"
Dim SplitWord() As String = testsplit.Split(" ")
Dim wc As Integer = SplitWord.Length - 1
Do While index <= wc
SeatNewRow = SeatDS.Tables("Seat").NewRow()
SeatNewRow.Item("MovieID") = SplitWord(1)
SeatNewRow.Item("Seat") = SplitWord(index)
SeatDS.Tables("Seat").Rows.Add(SeatNewRow)
index += 1
Loop
SeatDA.Update(SeatDS, "Seat")
|
|
|
|
|
I use this code to add a custom control to a panel :
Dim usc As New InvoiceCTRL
usc.Top = y
usc.Left = 20
Me.Panel1.Controls.Add(usc)
y = y + 20
when the panel is filled & scroll bar appears,
the added controls appear very distant from each other.
i figured out thats because y is measured from THE Appearing Area of the panel not from the virtual top
is there a solution so the added controls appear uniformly separated from each other ??
all right,
i used a flowlayoutpanel instead,it worked,
modified 9-May-12 4:45am.
|
|
|
|
|
Location is an offset from 0,0 in the client area of the form, not the visible area of the client area of the form. The scroll bars have nothing to do with the placement of controls so there's something else going on that we can't see in your code.
|
|
|
|