|
What C++ .DLL? What function call are you talking about? What parameter?
This process process is no different than calling a Win32 API function, which are just other C++ .DLL's.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have solved the problem.
Thanks.
|
|
|
|
|
In VB.NET
2 part question:
I want a DataRow that contains a column with a specified value.
Part 1: would the following work to identify the row that contains the value and assign it to the DataRow?:
drPart = DsParts1.Tables("EventID").Rows.Find(iEventId)
‘where EventID is the column and iEventId is the value.
Part 2: Once I have identified the row with the value and assigned it to drPart, how do I assign the index of that row in the table to iIndex variable?
Thanks.
|
|
|
|
|
1. Will work only if the value you are searching for is in your PrimaryKey column. If not use the DataTable.Select function. You can even use complex queries there.
2. I think there is no elegant way to get the index. If your really need it you will have to determine it yourself:
public int IndexOf(DataRow row, DataTable table) {
for (int i = 0; i < table.Rows.Count; i++)
if (table.Rows[i] == row)
return i;
return -1;
}
Note that this is not very effective and should not be used with large DataTables.
|
|
|
|
|
Thank you, Robert.
I have been working on it and between two VB.NET books I was able to figure out how to use select method to form a subset. You are right about using select, it was much simpler than what I had originally thought to do. I was going to use the index (if it existed) and move through the data table to find the rows I wanted.
|
|
|
|
|
Imports System.IO
Imports System.Collections
Imports System.Runtime.Serialization.Formatters
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
<system.diagnostics.debuggerstepthrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(24, 192)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(104, 32)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(160, 192)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(96, 32)
Me.Button2.TabIndex = 1
Me.Button2.Text = "Button2"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim vendor As company = New company
Dim buyer As company = New company
Dim goods As lineitem = New lineitem
Dim po As purchaseorder = New purchaseorder
vendor.name = "acme inc."
buyer.name = "wiley e. coyote"
goods.description = "anti-roadrunner cannon"
goods.quantity = 1
goods.cost = 599.99
po.items(0) = goods
po.buyer = buyer
po.vendor = vendor
Dim sf As Soapformatter = New soapformatter
Dim fs As FileStream = File.Create("c:\po.xml")
sf.serialize(fs, po)
fs.close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim sf As soapformatter = New soapformatter
Dim fs As FileStream = File.OpenRead("c:\po.xml")
Dim po As purchaseorder = CType(sf.deserialize(fs), _
purchaseorder)
fs.close()
MessageBox.Show("customer is " + po.buyer.name)
End Sub
End Class
Public Enum purchaseorderstates
ISSUED
DELIVERED
invoiced
PAID
End Enum
<serializable()> Public Class company
Public name As String
Public address As String
Public phone As String
End Class
<serializable()> Public Class lineitem
Public description As String
Public quantity As Integer
Public cost As Double
End Class
<serializable()> Public Class purchaseorder
Private _purchaseOrderStatus As purchaseorderstates
Private _issuancedate As DateTime
Private _deliverydate As DateTime
Private _invoicedate As DateTime
Private _paymentdate As DateTime
Public buyer As company
Public vendor As company
Public reference As String
Public items() As lineitem
Public Sub New()
_purchaseOrderStatus = purchaseorderstates.ISSUED
_issuancedate = DateTime.Now
End Sub
Public Sub recorddelivery()
If _purchaseOrderStatus = purchaseorderstates.ISSUED Then
_purchaseOrderStatus = purchaseorderstates.DELIVERED
_deliverydate = DateTime.Now
End If
End Sub
Public Sub recordinvoice()
If _purchaseOrderStatus = purchaseorderstates.DELIVERED Then
_purchaseOrderStatus = purchaseorderstates.invoiced
_invoicedate = DateTime.Now
End If
End Sub
Public Sub recordpayment()
If _purchaseOrderStatus = purchaseorderstates.invoiced Then
_purchaseOrderStatus = purchaseorderstates.PAID
_invoicedate = DateTime.Now
End If
End Sub
End Class
|
|
|
|
|
|
i am working out of a book called "network programming in .net" by fiach reid. first off it says to
ImportsSystem.Runtime.Serialization.Formatters.soap
the error message says 'the namespace or type 'soap' cannot be found'.
the second error occurs down the line of code
Dim sf As soapformatter = New soapformatter
the error message says 'type soapformatter' cannot be found
|
|
|
|
|
You are missing a reference.
Search your project in the solution explorer, right click 'References' (should be right beneath the project name), click 'Add reference', click the '.NET' tab, search for 'System.Runtime.Serialization.Formatters.Soap', double click it and hit Ok.
The second one will be frightened when the first one is gone and will also vanish
|
|
|
|
|
thank you my friend i think i got it.
|
|
|
|
|
Hi there,
I am developing a VB.Net application and find myself typing the same code over and over or cutting and pasting the code from somewhere else in my application. Does anyone know of a add-in or something that will allow me to define a number of different "templates" of static code that I can then just hit a key sequence (or something like that) and have the template code inserted from where my cursor is?
This would really be a time save for me. I could write it myself, but I don't want to take the time to do so.
Thanks for any help anyone can give me.
Wes
|
|
|
|
|
Hello,
You might want to try recording Macros that will automatically type in the text that you have recorded to it. Macros can be accessed by going to: Tools -> Macros.
Once you are finished recording your macro, the next time the macro is run it will do exactly what you recorded. I think you will need to type in the code manually when you are recording the macro.
I haven't had much for personal experience with macros in Visual Studio, however, if works the same way as it does in MS Word, it should work.
I hope this helps,
Programmer2k4
My sig:
"The so-called 'Bugs' do not exist, they are merely features hidden by developers with message boxes that say 'An unhandled exception has occurred'." - Programmer2k4
"And it is a professional faux pas to pay someone else to destroy your computer when you are perfectly capable of destroying it yourself." - Roger Wright
I now use my CodeProject Blog!
|
|
|
|
|
Hi everybody;P
I have been away from parogramming for 4 years and now i want to return to it again. I am trying to learn Vb.net and Sql server as well as ASP .
I know that i can't do programming by only reading the books ,can you just give me some advices how can i improve and learn more please.
many thanks
Afsaneh
|
|
|
|
|
1. You CAN learn by 'only reading books' - that's what I did
2. What did you use before ? Was it VB ? Why are you learning VB.NET ? VB is CRAP ( sorry to everyone else on this forum ). To quote a former VB6 user - 'VB.NET could have been a good language, but all the VB6 hacks ruined it. Now all good VB programmers have moved to C#.' C# is no harder, but it has the advantage of being a real language.
3. I assume when you say ASP, you mean ASP.NET ?
Don't try to learn all this stuff at the same time, do it one at a time. Get a book on C#, and work through it. Then, when you understand the language syntax, get a book on ASP.NET and learn how to use C# to write web sites. THEN get a book on T-SQL, and learn that. T-SQL is the easiest of the lot, but if you learn enough to write a database, it won't be much good to you without the code to be calling it
And by all means, as you set yourself some learning projects, ask questions in the appropriate forums as you get stuck. One final reason to use C# - compare how many people use the C# to the VB.NET forum
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Christian Graus wrote:
compare how many people use the C# to the VB.NET forum
Eventhough it is very likely that there are more C# users here at CP, it may be the case that people have fewer problems in VB.NET than in C#. The statistical data is inconclusive...
--
My name in Katakana is ヨルゲン.
My name in German is Jörgen.
I blog too now[^]
|
|
|
|
|
Dear Friends,
I want to display my all pictures from a folder in to the picture boxes on a frame controll. how can i display many no of picture boxes on the frame at one time with scroll bar. it means i wanna know how i can use scroll bar on a frame to show no of picture boxes. your help will be higly appriciated.
Thanks
Murtuza Patel.
|
|
|
|
|
Here's one way to try this if you want to. Create a new form in VB.NET, drag a list veiw onto your form, and drag a image list onto your form, bind all your images to your image list, and in the list veiw properties on the right you will find the property lage image list, click on it and bind your images to the list veiw and then click on the + beside large image list and size your images accordingly, i placed mine at 100 by 100. Hope this helps
Delo
|
|
|
|
|
hi i have a prob using the winsock activex control in c#.net. everytime i drag it on the form builder i get a msg sayin u do not have a license to use this control. what do i do? pls help
c#psyco
|
|
|
|
|
|
I have a mail merge document that I am automating to pull data then print to postscript. The document ends up being converted to a .pdf and emailed to the user. However, I am having a problem where the doc is losing the data connection during the process.
Specifically the doc is saved with a reference to a local .xls file for its data. Prior to running the VB.NET process, the doc can be opened directly several times and each time it will ask to connect to the .xls file. I will then start the VB.NET process and it will run, creating the .pdf without the updated info. When returning to the original doc, it no longer asks to reconnect to the .xls file and I am forced to attach it again.
Any thoughts? Could it be a permissions issue?
Here is the Print source. Pretty straight forward.
Private Sub PrintReport()
Dim WordApp As Word._Application
Dim wordDoc As Word._Document
Dim iReportID As Integer
Try
Select Case Inventory.Profile
Case "YUD"
iReportID = 1
Case Else
iReportID = Inventory.Profile
End Select
m_sTemplateName = GetReportName(iReportID)
TextBox1.Text += DateTime.Now.ToLongTimeString & ": Generating Report..." & vbCrLf
TextBox1.Refresh()
Dim i, j As Integer
Dim pages As String
Dim fullpath As String = m_sInPath & m_sReportName
WordApp = New Word.Application
If File.Exists(m_sRoot & "reports\" & m_sTemplateName) Then
TextBox1.Text += DateTime.Now.ToLongTimeString & ": Opening document: " & m_sRoot & "reports\" & m_sTemplateName & vbCrLf
TextBox1.Refresh()
wordDoc = WordApp.Documents.Open(m_sRoot & "\reports\" & m_sTemplateName)
Else
TextBox1.Text += DateTime.Now.ToLongTimeString & ": File: " & m_sRoot & "reports\" & m_sTemplateName & " does not exist. Please correct the problem and restart the application." & vbCrLf
TextBox1.Refresh()
btnEnd.PerformClick()
End If
'wordDoc.SaveAs(fullpath)
'pages = wordDoc.Bookmarks.Item("Print").Range.ComputeStatistics(Word.WdStatistic.wdStatisticPages)
'wordDoc.PrintOut(background:=True, range:=4, outputfilename:=fullpath, pages:="1-" & pages) ' named after USERID
'Delete file if exists
If File.Exists(fullpath) Then
File.Delete(fullpath)
TextBox1.Text += fullpath & " exists. File deleted." & vbCrLf
TextBox1.Refresh()
End If
'Write out new file
pages = wordDoc.Bookmarks.Item("Print").Range.ComputeStatistics(Word.WdStatistic.wdStatisticPages)
wordDoc.PrintOut(background:=True, range:=4, outputfilename:=fullpath, pages:="1-" & pages) ' named after USERID
wordDoc.Close(True)
wordDoc = Nothing ' close doc
WordApp.Quit()
WordApp = Nothing ' close word
Catch ex As Exception
TextBox1.Text += DateTime.Now.ToLongTimeString & ": Process Failed in PrintReport" & vbCrLf
TextBox1.Text += ex.ToString & vbCrLf
TextBox1.Refresh()
EmailError(ex.ToString())
btnEnd.PerformClick()
'btnStart.PerformClick()
End Try
End Sub
CitizenSoldier
|
|
|
|
|
Hello all,
I have an ASP.net page that uses an "asp:DataGrid" tag that is populated by a System.Data.DataSet object. Data is sorted via a "sort_value" field in the SQL table.
Until now, this page has just been for the display of data. Data entry is handled via a separate system.
Now, I need to add the ability to change the order of the data records from this screen. (Via changing the underlying "sort_value" field...)
What is the best way to do this in VB.net?
The UI needs to implement a "move up", "move down", "move first", and "move last" button/link next to each data row on the paged display.
Any ideas?
Thanks for the help,
David
|
|
|
|
|
|
It would be better if you posted this in the ASP.Net Forum. The asp:Datagrid is not a VB.Net object and that forum has more knowledge of the control. Or try search articles
|
|
|
|
|
|
hi, i had found many example of speech sdk 5.1 that implemented in vb 6. may i know will speech sdk 5.1 work with vb.net?
beside that, i had tried to code text-to-speech program with vb.net. it work but I not sure does speech recognition (SR) will work in vb.net cox i not capable found any example for it in internet!
By the way, if SR is working in vb.net. will i have to learn XML for coding SR?
pls reply me cox i SR is the main core module in my project.....
thanks
|
|
|
|