|
You can implicitly open a form without showing it.
I keep all pictures i use in one form and use them from there:
Me.Icon = frmPictures.Icon
or
Me.tvwArticles.ImageList = frmPictures.imlNodePics2
Hope this helps
Grtz, Guus
|
|
|
|
|
I want to kill an executable from my VB application. I can't use window handles and WMI. Any suggestion will be great!
Thanks
Shyam
|
|
|
|
|
In VB, your going to need either the ProcessID or the Window Handle to kill the process, so you can send the WM_CLOSE message to the top level window.
In VB.NET, you can use the System.Diagnostics.Process class to kill the process you want.
RageInTheMachine9532
|
|
|
|
|
email me to send good program for you
hmdfar@yahoo.com
|
|
|
|
|
I currently have a timer that uses an array to see if there are specific exe's running on my machine.
Dim strProcArray() As String={"notepad","calcualtor"}
Dim i As Integer
For i=0 To UBound(strProcArray)
buildProcess(strProcArray(i))
next i
End Sub
So here is my question?
Is it possible to use a data reader (SQL SRVR2K) to to query a table with exe file names in it and loop through that as my array? Is a data reader the right choice? If possible a sample would be great.
Regards
|
|
|
|
|
Dim conn As New SqlConnection(''''YourConnectionStringHere)
Dim cmd As New SqlCommand
Dim dr As SqlClient.SqlDataReader
With cmd
.Connection = conn
.CommandType = CommandType.Text
.CommandText = "SELECT ExeName FROM tProcessNames"
.Connection.Open()
dr = .ExecuteReader(CommandBehavior.CloseConnection)
While dr.Read
buildProcess(dr.Item("ExeName").ToString)
End While
End With
dr.Close()
If I understand you right that should do it. Hope it helps
|
|
|
|
|
Hi guys.
Am working on an app that needs to dump some product codes into a col in Excel (2K3). Unfortunately, some of the prod codes are numeric, some textual. Naturally, when adding through code, Excel left justifies the text ones, and right justifies the numerics.
Have tried to add a "'" before the data, and this does in fact cause excel to L-Justify the data, however, in 2K3, it causes an error smart tag stating that "the number in this cell has been formatted as text or is preceded by an apostrophe"
What I'd really like to do is format the entire Column as a Text only column - any ideas how to do this from code - is simple using the Excel front end, but can't find a way to do it from code....any ideas?
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
Here is how I format columns in excel using a CExcel class module:
Set objExcel = New CExcel
With objExcel
.OpenExcelFile strFilename, "Visit List"
.StoreExcelRange "A1", lngRecsProcessed + 3, 13, varDataArray
.FreezePanes "A3", True
.SetExcelRowBold 1
.SetExcelCellWidthAutoFit
.FormatColumn "A", "000000000"
.FormatColumn "E", "$#,##0.00"
.CloseExcelFile
End With
Set objExcel = Nothing
Here is the actual code in the FormatColumn
m_objWorksheet.Columns(p_strColumn).NumberFormat = p_strFormat
To see exactly what code excel uis doing you could record a macro in Excel as you format the column. The code you need will be in side the macro code and is easily migratable to VB
|
|
|
|
|
Yeah - appreciate your help, but what I was after was something allong the following lines:
oWorkSheet.Cells(lRow,lCol).Errors(xlNumberAsText).Ignore = True
Thanks for the help tho....
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
Need Help! I created a program complete with a Set-up disk that created a start up short cut. The trial set-up ran and worked great on my Desk Top that it was created on which has a copy of Visual Basic.net loaded, (Windows XP)however when I attempted to run it on my laptop(Windows 98) it was a no go. When I loaded the disk the setup ran fine but when I attempted to run the program no luck. I had downloaded the Dotnetfx.exe file onto my laptop. Here is the message I get: "common language runtime debugging service application has generated an exception that could not be handled. Process id = 0xfff50 aaf[-718161}, Thread id = 0xfffb35b3{-313933}. Click OK to terminate application. Click cancel to debug the application." I tried clicking cancel and got the following message. "registered JIT debugger is not available. An attempt to launch a JIT debugger with the following command resulted in an error code of 0x2 (2). Please check computer settings. cordbg.exe! a 0xfff50 aaf. Any ideas how to make this work so I can distribute it? This is the first program I have written with .net!
|
|
|
|
|
Hello guys,
I'm novice in VB 6.0 but have some skill in VC++.
I'm developing COM-server using Visual C++ and "thin client" in VB 6.0 ("late binding").
One of function is present in COM-server as follows:
[id(5), helpstring("method Encoder")] HRESULT Encoder([out] long * Result, [out] long * LastError);
As you see, method "Encoder" receives two pointers to long data type. I can invoke that method from client written on Visual C++, but I can't do that on VB.
Is it possible to call method "Encoder" from VB Client? How?
Or I need to rewrite my COM-server and include two separate methods:
- get_EncoderResult
- get_EncoderLastError
?
Yours sincerely,
Alex Bash
|
|
|
|
|
Both VBScript and VB can't call via IDispatch (what you call "late binding" in VB world) methods that receive arguments ByRef.
You can do this via early binding, though. I see you have your IDL interface defined, so why are you calling this using late binding?
Trying to make bits uncopyable is like trying to make water not wet.
-- Bruce Schneier
By the way, dog_spawn isn't a nickname - it is my name with an underscore instead of a space. -- dog_spawn
|
|
|
|
|
Really?
' Client's code - VB6:
Dim o As Cx, o2 As Object
Dim p1 As Long, p2 As Long
...
Set o = New Cx
Set o2 = o
...
p1 = 0: p2 = 0
o.Encoder p1, p2 ' Call by vtable => early binding
p1 = 0: p2 = 0
o2.Encoder p1, p2 ' Call by GetIdsOfName&Invoke => late binding
p1 = 0: p2 = 0
CallByName o, "Encoder", VbMethod, p1, p2 ' forcible late binding
p1 = 0: p2 = 0
CallByName o2, "Encoder", VbMethod, p1, p2
' Server's code - C++:
STDMETHODIMP Cx::Encoder( long * Result, long * LastError)
{
*Result = 22;
*LastError = 222;
return S_OK;
}
With best wishes,
Vita
|
|
|
|
|
Vi2 wrote:
Really?
' Client's code - VB6:
<code>
Dim o As Cx, o2 As Object
Dim p1 As Long, p2 As Long
...
Set o = New Cx
Set o2 = o
...
p1 = 0: p2 = 0
o.Encoder p1, p2 ' Call by vtable => early binding
</code>
Vi2 wrote:
<code>
STDMETHODIMP Cx::Encoder( long * Result, long * LastError)
{
*Result = 22;
*LastError = 222;
return S_OK;
}
</code>
I don't think a call to Encoder from a VB6 client will work with the above Encoder definition. At least when I attempted to call Encoder from a VB client using the above Encoder definition in a C++ COM object the program crashed. Is this normal behavior? Or, am I overlooking something?
Thanks,
|
|
|
|
|
That's because VC++ can handle [out] parameters - VB cannot. In order to return a logical value back to a VB client your interface's final parameter must be marked as [out, retval]. However, you're wanting to return multiple values which is best suited for SAFEARRAYS.
So your question was:
Is it possible to call method "Encoder" from VB Client? How?
With your current implementation? No
|
|
|
|
|
can someone tell me where to find the dial up info on a winxp pc
In the registry in some file some where where is it please help thank
lata
|
|
|
|
|
I've searched around, maybe not hard enough, but I just can't seem to find a way to input data in "a" textbox as feet and inches without using two textboxes. (Visual Basic.NET 2003)
Does anyone know how I might be able to do this?
The inputed data will be used to compute sqaure and cubic feet later on in code, a dollar amount will be later multiplied to this. If that helps at all.
Thanks Folks,
Dooglo
|
|
|
|
|
I'm sorry for the subject but ashamed as I am, I can't think of how to summerize (or realy even how to say) what I am looking for.
First let me say that I'm not asking anyone to write my code for me or show me step by step but I'm asking more for someone to tell me what I need to look for.
I am trying to figure out how to make a program open files that I click on. I know that is a windows setting and I know how to make my program the default
My problem is that if I make my text editor the default text editor (tell windows to open all .txt with it) then click on a .txt, it launches my program but it doesn't open the txt file.
My problem is that I don't even know what to search for to find info on this problem.
I'm sure its simple so please don't just discard this as someone who is totaly ignorant. I have taken a hands-on aproach to vb.net as my learnvisualstudio.net lessons teach and so when I got comfortable with the basics I just started writeing and search for things as I need them.
Again, my problem now though is that I don't even know what to search for.
Thank you
2 U.S. coins equal 30 cents and one is NOT a nickle. Hmm..
|
|
|
|
|
Does your app take command-line arguments? When you double-click an item in Windows Explorer, it launches something like this (unless the association is configured differently):
RegisteredApp.exe C:\Path\DocumentYouClickedOn.txt
If your app doesn't process the command-line arguments, you'll never know what file to open on launch.
Your association can be configured to launch your app in different ways, using different command-line args or using DDE, or something else. By default, it'll launch using the above method.
To find out more, just open a window in Explorer, like C:\, go to the Tools/Folder Options menu, then click on the File Types tab. Next, scroll down to TXT (Text Document) and you'll find the definition for TXT and Notepad. You'll find 3 actions if you click on Advanced: Open, Print, and PrintTo. Click on Open, then on Edit and you see that Notepad is launched like this:
C:\WINDOWS\system32\NOTEPAD.EXE %1
The %1 is replaced by the full path to the document that you double clicked on.
RageInTheMachine9532
|
|
|
|
|
IC,
Thank you. I knew how windows handled opening documents but I had no idea how to catch that in my aplication. So now I know where to start (read up on accepting command line options/paramiters)
Thank you very much. This was what I needed to know++.
2 U.S. coins equal 30 cents and one is NOT a nickle. Hmm..
|
|
|
|
|
Hi,
Currently i'm developing a system that store inventory record. In my system, i have a database named "rnz.mdb" and it has a table named "recordsList". The PK for the table is FormSerialNumber. The FormSerialNumber is like this --> 68001-001-001. The 1st 5 digit shows the form code.(68001 is the code for inventory form). The 3 digit in the middle is the item ID and the last 3 digits is the number of changes that have been made to the item(for example, computer upgrading). In the field also, there is a field named "Date". My problem is, my boss want the system to display the latest record for each item and at the same time keep the previous record of each of the item. The previous record will became the record's history. I can do the record history part. My problem is the latest record. How can I extract the latest record for each item from the list of records .
|
|
|
|
|
Try this:
Select * from sometable a
where a.FormSerialNumber = (Select max(b.FormSerialNumber)
from sometable b where a.identifier = b.identifier
This way you select the latest record
Hope this is the answer to your "VB" guestion
Grtz, Guus
|
|
|
|
|
|
What's the best way to document classes that you write in .NET? I know C# has some XML-comment documentation abilities, but VB .NET is limited. Plus the output of those is rather ugly.
I would like to be able to deliver nice "MSDN-looking" HTML documenation to the developers who will be using my classes, but I don't want to spend more time on the docs than on the code!
Barry Etter
|
|
|
|
|
The support for XML documentation provided by the C# compiler is very nice... using the xml output it produces combined with a tool like NDoc[^] creates very nice "MSDN-looking" documentation. Or if you don't want to use NDoc, you can always create your own XSL stylesheet to process the xml documentation.
It's too bad that the VB.NET compiler does not support the same feature. You may want to look at the following:
http://vb-doc.sourceforge.net/[^]
http://www.fesersoft.com/products/VBXmlComments/[^]
http://vbxmldoc.tor-erik.net/[^]
I haven't used any of these, so I can't offer a recommendation. But one may be what you're looking for.
|
|
|
|