|
Our Instant VB C# to VB.NET converter (www.instantvb.com) produces the following:
Private Sub test()
Dim arrReturn As Object() = Nothing
Dim SP_NAME As String = "GetIDProc"
Dim RetID As String
Dim parameters As SqlParameter() = { SqlAccessor.SqlParameterBuilder("@RetOrderID", SqlDbType.VarChar, 10, ParameterDirection.Output)}
Dim iRow As Integer = SqlAccessor.ExecuteNonQuery(connectionString, SqlAccessor.SqlCommandBuilder(New SqlCommand(SP_NAME), parameters), CommandType.StoredProcedure, arrReturn)
RetID = CStr(IIf(arrReturn(0).Equals(System.DBNull.Value), 0, arrReturn(0)))
If iRow > 0 Then
Dim myFormat As String
Dim d As DateTime = New DateTime()
OrderNum.Text = d.Year.ToString() & "/" & RetID
Else
OrderNum.Text = "Cannot Get Details"
End If
End Sub
David Anton
Tangible Software Solutions
www.tangiblesoftwaresolutions.com
Home of the Instant C# VB.NET to C# Converter and the Instant VB C# to VB.NET Converter
|
|
|
|
|
David,
Thanks for the reply. Somone gave me this code but they didn't tell me what they declared SqlAccessor as. Would you have any ideas what SqlAcessor should be declared as from looking at the code??
Thanks.
|
|
|
|
|
Sorry - there's a number of different classes with a "ExecuteNonQuery" method. And there are no classes that sound close enough to SqlAccessor, so I couldn't say what it's declared as.
David Anton
Tangible Software Solutions
www.tangiblesoftwaresolutions.com
Home of the Instant C# VB.NET to C# Converter and the Instant VB C# to VB.NET Converter
|
|
|
|
|
HI to all
Please tell me how to create the setup file for the project which have database (SQL SERVER 2000) in it?
Please exaplain me the whole procedure of creating the setup file so that i can install this project on any other machine.
Thanx for help in advance.
BYE from ARFAN QADIR
|
|
|
|
|
Deploying apps is pretty simple and you should be able to get detailed information from any VB.net book. However, to get you started, right click on your solution, select Add->New Project then click on Setup and Deployment Projects and select Setup Wizard. In the options select Setup for windows app and <primary output<="" b=""> from your project.
The setup automatically detects all dependencies needed for your app.
Now, if your project has a database then you should be able to include any additional files in your setup project.
|
|
|
|
|
Hi.
I have a VB.NET program that is creating Word documents based on an existing template file by filling in data retrieved from a database. Some of the content in the Word document is maintained in custom properties, however, although it is very easy to manage these from with a Word macro, I am having difficulty getting hold of the CustomDocumentProperties collection from within VB.NET. Originally, I tried having a variable of type Word.CustomProperty which I would use, in conjunction with the CustomDocumentProperties collection, but had absolutely no joy. Am I being stupid and missing something very obvious.
The problem seems to be that for some reason, CustomDocumentProperties is of type System.__COMObject and does not have any discernable methods or properties. For now, I have created a single line word macro (as part of the original template) that simply sets a custom property to the value you desire, but this is far from ideal, and really goes against the grain for me!! Unfortunately, this is not a solution that can be entirely coded in Word as it is essentially a very small part of a bigger solution (the word doc is just something that is produced at the same time as other things)
Does anyone have any experience with CustomDocumentProperties from VB.NET when talking to Office 2003. I prefer to use Option Strict On, but if it is necessary to turn it off, I will!
A code snippet from .NET that I am using (simplyfied) is shown below. Any help with this would be greatly appreciated
Imports Word = Microsoft.Office.Interop.Word
..
..
..
Dim oWord As Word.ApplicationClass
Dim docCurrent As Word.Document
'
' Start MS Word and open the document.
'
oWord = CType(CreateObject("Word.Application"), Word.ApplicationClass)
docCurrent = oWord.Documents.Open(FileName:="C:\MyOriginalDoc.doc", ReadOnly:=True)
'
' Since it seems impossible to get to the CustomDocumentProperties collection with the Word
' object Model through VB.NET, we run a little macro that is embedded in the template to
' populate the custom properties. Not nice, but apparently necessary - although I won't be
' defeated, so whatch this space!
'
oWord.Run("SetDocProperty", "PhaseDescription", strPhaseDesc)
'
' And now we update the fields
'
docCurrent.Fields.Update()
oWord.Options.PrintFieldCodes = False
docCurrent.PrintOut()
docCurrent.SaveAs("c:\MyNewDocument.doc")
'Quit Word.
oWord.Quit()
Marshal.ReleaseComObject(oWord)
oWord = Nothing
|
|
|
|
|
I have a command in my project like:
wordDoc.Content.Find.Execute(FindText:="#TEST#", ReplaceWith:="ABC" & chr(13) & "DEF", Replace:=Word.WdReplace.wdReplaceAll)
This code will replace #TEST# with this one
ABC
DEF
but , once i have this Word document... the content became ABCDEF , where there is no more "carriage return" in between..
anyone can help me??
|
|
|
|
|
="ABC" & chr(13) & chr(10) & "DEF"
|
|
|
|
|
that coding also can't solve the problem..
|
|
|
|
|
I have solved the problem. the template file i opened is in .rft format. i try to change the format to .doc. then the problem solved..
|
|
|
|
|
hai..i have an access database with 38 tables..
the problem is with the data reports..
its getting delay generating reports and sometimes its displaying the report with some fields missing from the database..and the report is not at all refeshing...
its displaying the old records only...
how can i solve this problem...everyhtis is perfect with connection..
how to avoid the delay..
plz help me
thanks in advance
|
|
|
|
|
hello VB programmers,
i would like to give a window page as an input to printer. please help me to clarify my doubt. Otherwise give me a idea of "how to print the content of a page in printer?"(in VB6.0). Mail me as soon as possible.
lovingly urs,
mahee...
|
|
|
|
|
|
I am unable to implement drill down in vb.net. pls help me, if possible send the code.
|
|
|
|
|
What are you trying to drill down into ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
Has anyone tried trapping the sort event of a datagrid in VB.NET?
We can set the AllowSorting property to true.Then when the column header is clicked,the rows get automatically sorted in ascending and descending order.
However this event isnot listed in the events dropdown list.
I need to trap this event for:
Im populating the grid using a temporary datatable.When the grid is sorting records, I need the temporary table also to be sorted in ascending or descending order.
Any help on this would be gr8.
|
|
|
|
|
implementing this is going to more of a headache than it's worth. when you click the column headers of a datagrid, the underlying datasource's (so long as you are binding to a datagrid, datatable, or dataview) dataview property is going to be re-sorted as well. just use that to access your data.
or, another option is to use the bindingmanagerbase and currency manager to access the particular data you want.
hope this helps.
-jim
|
|
|
|
|
Hello All,
I am new to VB.NET programming, Does anybody know how to display more than one value in Listbox (the same like listbox display in MS Access where you can select a table/query in row source property and display any values you want). Thank you
dw1928
|
|
|
|
|
Yes, it's a property on the listbox, I think it's called 'Details' ( that's the enum value, not the property to set ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi, do you have any suggestion on the problem that I have. Thank you
|
|
|
|
|
i think if you have an IList (arrayList, SortedList, etc...), you could pass it to the DataSource property of your listBox. use it accordingly with DiplayMember and ValueMember...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi,
How to mark / highlight some selected text in doc or txt ?
Plz help me.
Regards,
Shri
|
|
|
|
|
what do you call "HighLighting a text" ??
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
How do I delete a control programatically in vb.net?
|
|
|
|
|
Hi jlart
No doubt I'll get told off by someone for doing it this way......
A control can be treated like a Window. In fact - it IS a window. You can delete it by getting a handle on the control, and invoking an API call like this:
1. Let's assume you want to delete a button called 'Button2' from your form.
2. Make sure you have the following Imports statements at the beginning of your program:
Imports System
Imports System IO
Imports System.Diagnostics
3. Add the following declaration. This is just a call to the API32 .dll:
Declare Function DestroyWindow Lib "user32" (ByVal hWnd As Long) As Long
4. Then - all you need to do to delete a control is call the following code from within your calling procedure:
Dim hControl As Long = Button2.Handle.ToInt32 'Button2 is used in this example
DestroyWindow(hControl) 'This deletes button2
5. This is very crude, but it works. Obviously be sure to embed suitable exception handlers; I just gave this code as an example - not as a definitive or perfect answer
Hope that helps a bit. No doubt someone will point out a MUCH better way without the API function call
Sophie
|
|
|
|