|
how to get the filename of the file being open and pass it to the associated application..
|
|
|
|
|
|
yeah i have it already.. my problem is how to get the filename of file being opened.. i want that my application know the filename of the file being opened..
|
|
|
|
|
This is in the article that he referenced.
Click on "&Open". You will see in the Properties window "Name", "Arguments", "Verb". Verb is hidden from the user, but is the key that is stored in the registry. Leave it the same as the name, but without the "&". The default for "Arguments" is "%1", which means to pass the full path and filename to your application. You can add other stuff here as well, if you need to pass flags to your application to do special stuff. All this information is getting passed to your application on the command line, so you'll need to be familiar with the "Environment.CommandLine" object.
It looks like the information you need will be passed in the command line that starts your application. So use enviroment.commandline to access it
|
|
|
|
|
tnx a lot 
|
|
|
|
|
Hello everyone,
In our project, we created a SSIS package to load data from Excel into SQL2005 database.
Right now, I want to write code (whatever is vb.net, Vbscrip, or SQL code) to change the existed excel worksheet name. If anyone can give me any suggestion with it, I will really appreciate it.
Jane
|
|
|
|
|
Sub Summary_cells_from_Different_Workbooks_1()
Dim FileNameXls As Variant
Dim SummWks As Worksheet
Dim ColNum As Integer
Dim myCell As Range, Rng As Range
Dim RwNum As Long, FNum As Long, FinalSlash As Long
Dim ShName As String, PathStr As String
Dim SheetCheck As String, JustFileName As String
Dim JustFolder As String
ShName = "summary" '< Change
Set Rng = Range("D3") '< Change
'Select the files with GetOpenFilename
FileNameXls = Application.GetOpenFilename(filefilter:="Excel Files, *.xls", _
MultiSelect:=True)
If IsArray(FileNameXls) = False Then
'do nothing
Else
With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
'Add a new workbook with one sheet for the Summary
Set SummWks = Workbooks.Add(1).Worksheets(1)
'The links to the first workbook will start in row 1
RwNum = 0
For FNum = LBound(FileNameXls) To UBound(FileNameXls)
ColNum = 1
RwNum = RwNum + 1
FinalSlash = InStrRev(FileNameXls(FNum), "\")
JustFileName = Mid(FileNameXls(FNum), FinalSlash + 1)
JustFolder = Left(FileNameXls(FNum), FinalSlash - 1)
'copy the workbook name in column A
SummWks.Cells(RwNum, 1).Value = FileNameXls(FNum)
'build the formula string
PathStr = "'" & JustFolder & "\[" & JustFileName & "]" & ShName & "'!"
On Error Resume Next
SheetCheck = ExecuteExcel4Macro(PathStr & Range("A1").Address(, , xlR1C1))
If Err.Number <> 0 Then
'If the sheet name not exist in the workbook the row color will be Yellow.
SummWks.Cells(RwNum, 1).Resize(1, Rng.Cells.Count + 1).Interior.Color = vbYellow
Else
For Each myCell In Rng.Cells
ColNum = ColNum + 1
SummWks.Cells(RwNum, ColNum).Formula = "=" & PathStr & myCell.Address
Next myCell
End If
On Error GoTo 0
Next FNum
' Use AutoFit for setting the column width in the new workbook
SummWks.UsedRange.Columns.AutoFit
SummWks.UsedRange.Value = SummWks.UsedRange.Value
SummWks.UsedRange.Columns("B:B").TextToColumns Destination:=Columns("E:E"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=True, Other:=False, _
TrailingMinusNumbers:=True
SummWks.UsedRange.Columns("C").Formula = "=sum(E1:IV1)"
MsgBox "The Summary is ready, save the file if you want to keep it"
With Application
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
End With
End If
End Sub
try it............
Imagine the I.T
|
|
|
|
|
Someone please help!
I am using the following code:
Dim h As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName)
Me.Text = "Local IP: " & CType(h.AddressList.GetValue(0), IPAddress).ToString
In Windows XP, this results in the top bar showing the local first ip address
eg:
Local IP: 192.168.1.11
When this same code is executed on Windows Vista,
it gives:
Local IP: fe80::7811:d6fc:e34d:2102%8
which is the ipv6 address.
My question is - how can I make sure my code retrieves the ipv4 address (always - even on vista).
I am stumped...
(I already have a way of detecting if I am running on Vista or not as the OS - in case it requires
different code..)
I can't find anything on this issue on the net either which is annoying...
Thank you for any feedback on this..
|
|
|
|
|
search in the visual studio help on IPv4InterfaceProperties Class see if that info helps
|
|
|
|
|
I've got an error message (no. vbc30205) when I'd try to make a dataadapter.
and compile error is "End of statement expected."
Dim dataadapter As New OleDb.OleDbDataAdapter=new oledb.OleDbDataAdapter(connectionstring)
What Does It Mean?
SH.M
|
|
|
|
|
Are you sure the error is occuring when you create the dataadapter object? It sounds like what you get when you have an SQL statement that isn't properly setup and you try to run the sql through a dataadapter or command object.
If I were you I'd double check my connection string and then check SQL statements.
And another thing...your statement seems wrong. You shouldn't have to new the adapter twice. And in visual studio 2005 I do not see a constructor that uses just the connection string for an oledb dataadapter. I think your statement should look more like this:
Dim myAdapter as New OleDb.OleDbDataAdapter(strSelectCommandString, strConnectionString)
Hope this helps.
|
|
|
|
|
I have noticed that the hide method and the visible property of the tab pages are only accessible to framework classes and not to developers. If I need to hide certain tabs I have to remove it from a collection of tab objects. Here is my question:
What if I remove a tab from the collection and then user shuts down the app, or the application crashes then what about the removed tab page? Is it gone? What can I do so I always have the tabs but only show the ones I need?
Does that make sense?
Thanks b4 hand.
Yoshimitsu
|
|
|
|
|
Obviously, when your app restarts, it recreates the tab control, with all the tab pages, your code defines this.
The only way I've found to add/remove tabs is to remove them, changing their visibility just doesn't work.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Im only a student soon to be graduate..were doing our thesis "Project development" we came up for an idea to make a system "thumb mark recognition system"..and for me it is impossible,it is my other co-member idea..
i know im helpless, but i do the program of it..cause in our group were only 2 programmer out of 5 members,other are web developers.
by the ways im blitz002 female from philippines..would you help me to make sure it is possible to make it on vb.net..thanks for reading....hope you reply it to me...
|
|
|
|
|
i believe it's possible to buy a system and integrate it with vb.net. vb.net cannot make it on it's own. you need the hardware for the finger print reader etc.
|
|
|
|
|
Yes, I have a client who has written a similar program. It's not much of a project tho, the fingerprint reader comes with the SDK to match fingerprints, so there wasn't much coding involved on their end.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
If you do a Google search using the terms: fingerprint reader you can find a lot of information. There are many vendors for this peripheral. Microsoft is one possible vendor. Their device was listed on Amazon for about $23 (US dollars).
Good luck with your project.
the Squeaker
|
|
|
|
|
Hey guys(and laddys of course ) i cant remember the name of this barcode format...It is like EAN13, but has a start digit, 6 numbers, another 6 numbers, and then a check digit...If anyone knows please let me know, thanks
Apparently it's not OK to start a bonfire of Microsoft products in the aisles of CompUSA even though the Linuxrulz web site says so
|
|
|
|
|
|
thanks
Apparently it's not OK to start a bonfire of Microsoft products in the aisles of CompUSA even though the Linuxrulz web site says so
|
|
|
|
|
I am inserting somewhat large files into an MySQL database. After about a minute or so I will get this message:
The CLR has been unable to transition from COM context 0x1a3008 to COM context 0x1a3178 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations."
It give the options for me to continue importing the files or stop. The program works fine its just this message that I am getting. Any ideas or solutions will be greatly appreciated.
jds1207
-- modified at 13:47 Monday 12th February, 2007
|
|
|
|
|
Hi jd,
The first question that comes to mind is, where does this message come from? From your code (MsgBox(Exception.Message) ), or does it come from windows itself?
If it is generated by your code, the answer is relatively easy: do not catch exceptions with a MsgBox but rather channel them to Windows's event viewer, or something.
If they are thrown by Windows itself, and they bother you enough, you will have to look into the message's suggestion: adapt your code so it doesn't just initialize a long term process and then sit there and wait for it to finish.
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
I'm a beginner in Vb.net 2003 version. There is a certain form i ahve that does not add records to the back end access database. Instead the system stops running and highlights in green the following line of code 'cmd.ExecuteNonQuery()'
What could be the problem with this specific file?
muraguri
|
|
|
|
|
muraguri wrote: Instead the system stops running and highlights in green the following line of code 'cmd.ExecuteNonQuery()'
What could be the problem with this specific file?
You have to tell us what the command is. A code sample would be good.
We also need to know what the error message (the exception message) is also.
|
|
|
|
|
The code is as follows:
cmdSave.Enabled = True
strsql = "INSERT INTO Worksheet(WorksheetNo,DriverName,CustomerName,VehicleRegistration,PickUpPoint,Destination,StartTime,EndTime,Transaction,Smileage,Emileage,Distance,Rate,TotalCharge,VoucherNo,Condition,Cleared)" & _
"VALUES ('" & txtJDNo.Text & "','" & cboDriver.Text & "','" & cboCustomer.Text & "','" & cboVehicle.Text & "','" & txtPick.Text & "','" & txtDestination.Text & "','" & txtStart.Text & "','" & txtEnd.Text & "','" & cboTransaction.Text & "','" & txtDistance.Text & "','" & txtRate.Text & "','" & txtCharge.Text & "','" & txtVNo.Text & "','" & txtCondition.Text & "')"
oledbcon.Open()
Dim cmd As New OleDbCommand(strsql, oledbcon)
cmd.ExecuteNonQuery()
oledbcon.Close()
The error i get is 'An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll'
Muraguri
|
|
|
|
|