|
MySql is a valid insert command independently tested
I think first open doesn't fire events because it does not change the rs
it just inserts records in the DB
but the second is a select satement that changes the rs
|
|
|
|
|
to delete a row in a datagrid, i highlight the row and press a delete command button. this also works if i highlight the row and press delete on the keyboard. However, now i wish to perform calculations on the click of the delete command button. if delete on the keyboard is pressed, is there anyway to call the delete procedure? Thanks in advance!
|
|
|
|
|
If I'm following you correctly, what you're wanting to do is capture the delete keypress for the datagrid. The only useful way I've found for doing this is to inherit your own datagrid and then override PreProcessMessage to check for the delete key. I use this to confirm deletion before actually carrying it out. The class looks something like this:
<br />
Public Class DataGridConfirm<br />
<blockquote> Inherits DataGrid<br />
<br />
Public Overrides Function PreProcessMessage(ByRef msg As System.Windows.Forms.Message) As Boolean<br />
<blockquote>Dim keyCode As Keys = CType((msg.WParam.ToInt32 And Keys.KeyCode), Keys)<br />
<br />
' If this is a "KeyDown" message and the key pressed was "Delete"<br />
' then we need to verify that the user actually wants to delete <br />
' the record by presenting a messagebox<br />
' Win32.Msg.WM_KEYDOWN just points to an Enum: WM_KEYDOWN=&H100<br />
If msg.Msg = Win32.Msg.WM_KEYDOWN And keyCode = Keys.Delete Then<br />
<blockquote>If ((MessageBox.Show("Are you sure you want to delete?", "AppTitle", _<br />
MessageBoxButtons.YesNo)) = DialogResult.No) Then<br />
<br />
' They've selected no, so simply return<br />
Return True<br />
<br />
End If</blockquote><br />
End If<br />
<br />
' If the user has not canceled the request, flow into the normal<br />
' message processing of the base control<br />
Return MyBase.PreProcessMessage(msg)</blockquote><br />
End Function<br />
</blockquote><br />
End Class<br />
After creating this class, just substitute it for the regular DataGrid your currently using.
Hope that helps!
|
|
|
|
|
hello :
I am new to vb.net and I am trying to get a specific row in a data view based on a user choice of one of my app. combo boxs here is my code
blocked_emp_view.Table = DataSet11.Tables("EMPLOYEE_BLOCKING")
Dim EmPCriteria As String
If Sender = 1 Then
EmPCriteria = CType(ComboBox2.Items(ComboBox2.SelectedIndex), DataRowView).Row.ItemArray(0)
Else
EmPCriteria = CType(ComboBox2.Items(ComboBox3.SelectedIndex), DataRowView).Row.ItemArray(0)
End If
DataSet11.Tables("EMPLOYEE_BLOCKING").DefaultView.RowFilter = "EMP_NO =" & EmPCriteria
blocked_emp_view.Sort = ("BLOCKING_DATE DESC")
blocked_emp_view.RowFilter = "EMP_NO ='" & EmPCriteria & "'"
I keep getting the same record each time although I change my selection any idea what is wrongthanks
Dalia
|
|
|
|
|
uSQL = "Insert Into OrderDetails2 (OrderNumber, ProductCode, ProductDesc, Quantity, UnitPrice, FullPrice)
Values (" & iOrderNo & ", '" & strCode & "', '" & strDesc & "', " & iQuantity & "," & iPrice & ", " & iFullPrice & ")"
Set RS = Conn.Execute(uSQL)
'MsgBox ("Adding record to the datagrid")
'refreshing the datagrid based on new info
RS.Requery
Me.Adodc3.Refresh
Me.DataGrid2.Refresh
the above is code for adding data to a datagrid. the Adodc3's recordset is the table OrderDetails2 and the datasource of the datagrid is Adodc3. However, when executed, it throws the above error - i have run the code many times before and it has never thrown this error. what is the problem? if it is referring to the RS, how do i open this to stop the error occurring?
|
|
|
|
|
this mat be the problem
Set RS = Conn.Execute(uSQL)
you need to call Conn.Open
|
|
|
|
|
Visual Studio.NET, when I make a program installer, uses NETSTREAM (which was Company name when XP and VS.NET were installed).
Company name has changed, but I can't find where to change this setting in VS.NET
Anyone help?
|
|
|
|
|
I am able to upload the a wave file from client computer to my web directory using "PUT" of webclient method
Although i've successfully upload the file but when i open the file in server site, it
show me the invalid data format.
----------------------------------
<webmethod()> Public Function upload(ByVal uriString As String, ByVal fileName As String) as string
Try
Dim myWebClient As New WebClient()
Dim responseArray As Byte() = myWebClient.UploadFile(uriString,"PUT",fileName)
return(Encoding.ASCII.GetString(responseArray))
Catch exc As Exception
return exc.Message
End Try
end function
----------------------------------
when i try to test upload a sample text file, i observe that header of the request is also written on file.for
example if my file name is "1.txt" and content of the file which is uploaded
on the server has content like this
-----------------------8c405c905b24bd0
Content-Disposition: form-data; name="file"; filename="1.txt"
Content-Type: application/octet-stream
elan
-----------------------8c405c905b24bd0
i think this is the problem why i always get invalid wave format in server site.
Please help me in solving this problem also since I could not find any thing
in webclient class to get rid of these headers.
Thanks in advance
|
|
|
|
|
I am having a very difficult time undersatnding the usefullness of implementing an interface here.
I tried to define one interface that has a AddEntry method:
Public Interface ILogEntry
Public AddEntry()
.
.
.
End Interface
Now, I want to impliment it from two different classes as such
Public Class One
Implements ILogEntry
Public Sub AddEntry(entryText as String) Implements ILogEntry.AddEntry
. . .
End Sub
End Class
Public Class Two
Implements ILogEntry
Public Sub AddEntry(varName as String, varValue As String) Implements ILogEntry.AddEntry
. . .
End Sub
End Class
...but I can't seem to get it because the method signatures in my class implementations don't match the actual use in each class.
What the heck is the use of useing an interface if it ties me to a specific method signature? I don't want to define the types and method signatures of the intrerface, just the actual methods that need to be implemented.
Am I wrong in thinking this or should I be using an abstract base class instead?
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
|
|
|
|
|
The usefulness of interfaces is very similar to abstract base classes. The purpose of an interface is as a contract to consumer objects that a particular method or property (or event for that matter) will be present - including its signature. You want consumer objects to know that an object implementing the ILogEntry interface will have an AddEntry method (or several overloaded versions of it). With an abstract base class, this concept is no different. I usually only use the abstract base class when there is code common to the derived classes and I want to eliminate duplication. However, due to being limited to single inheritance, the interface becomes again useful.
Consider some of the included interfaces with the framework: IEnumerable promises that there is a GetEnumerator method (which returns an object that implements the IEnumerator interface) and nothing more. But in those instances where one wishes to enumerate a collection, this is what is required and expected.
As to your particular problem, it appears that you have two method signatures - and your interface supplies neither. This is what you need for this example:
Public Interface ILogEntry
Public AddEntry(varOne as String)
Public AddEntry(varOne as String, varTwo as String)
.
.
.
End Interface
So long as the method signature matches, the compiler won't complain.
α.γεεκ Fortune passes everywhere. Duke Leto Atreides
|
|
|
|
|
I had tried (at least I thought that I had) to to that was when I tried to implement the interface I looked like I was forced to impliment BOTH the AddEntry methods in my class.
I think my problem was that NONE of the parameters to the methods matched in my case.
I was trying to use:
AddEntry(entryText As String)
AddEntry(varName As String, varValue As String)
Perhaps if I used the naming that you example did where at least one of the vars matched things would have been better?
I actualy am testing a version that uses an abstract base class now and it seems to be working well. I actually found some implimentation that was common so it ended up helping in reducing code duplication as well.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
|
|
|
|
|
I have a form which contains two MSHFlexGrids which are side by side. The reason for having two grids is so that I can simulate a Freeze Pane like in Excel. Both grids are populated from the same RecordSet but from different fields.
My question is when the user selects a row in one grid and highlights that row, how can I get the code to select the same row in the other grid and also highlight it?
|
|
|
|
|
The checkbox in access is called Completed. i am trying to populate a datagrid based on a SQL statement in VB, including this checkbox, but in the grid, it is only being displayed like a text field - is there anything i can do about this? here is my code for it - any help would be appreciated!
Dim checkSQL As String
checkSQL = "SELECT OrderGenerate.OrderNumber, Client.Company, OrderGenerate.Completed " & _
" FROM Client INNER JOIN OrderGenerate ON Client.ClientCode = OrderGenerate.ClientCode " & _
" WHERE (((OrderGenerate.OrderDate)=" & dToday & "))"
Set RS = Conn.Execute(checkSQL)
Adodc1.RecordSource = checkSQL
DataGrid1.Visible = True
Set DataGrid1.DataSource = Adodc1
Adodc1.Refresh
DataGrid1.Refresh
|
|
|
|
|
No, use a 3rd party control. Or use a ListView and add controls to edit the ListView above it with a Checkbox for the Field you'd edit.
|
|
|
|
|
I was just wondering if anyone else gets this problem too. When I have several ComboBoxes on a Form, and I resize it, all the Text in ever combobox (even if they do not currently have the Input Focus) becomes Highlighted! It's very annoying! The only way to get rid of it then is to Tab through each ComboBox.
Any ideas on how to resolve this?
|
|
|
|
|
I know .NET is different than 6 wrt control arrays. But shouldn't I be able to capture the CLICK on the following (fragment)?
Dim contArray(2) as Button
for i = 0 to 1
contArray(i) = new Button
contArray(i).tag = i
controls.add(contArray(i))
next i
...
private sub contArray_CLICK (...)
or something that lets me get the tag or index of the button clicked.
-David
|
|
|
|
|
Here is an example of how to do it in both VB.NET and C#
CodeProject Clickety[^]
Please keep in mind that I do not like how the article is formatted, but the content is ok.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
|
|
|
|
|
Thanks, works pretty good.
If I want to add the control array to a panel instead of a form, how would I declare the control?
|
|
|
|
|
Thanks, works pretty good.
If I want to add the control array to a panel instead of a form, how would I declare the control?
assuming a Panel1 on the main form,
Dim ControlArray as ButtonArray(Panel1) 'doesn't work since Panel1 is not a "form" container
|
|
|
|
|
Instead, change the Form reference to be an "IContainer" control since all Controls and Forms inherit from IContainer.
|
|
|
|
|
Thanks for the reply. But I'm new to .NET. If you mean, have the main form inherit from System.Windows.Form.IContainerControl it doesn't work. At least I get an error that says classes can inherit only from classes.
|
|
|
|
|
I'm trying to send email from within VB.NET and I get the following error: "Could not access 'CDO.Message' object." when I try to send the message. Here's a brief summary of my config:
Running Windows 2000, SP3 on our Company Ethernet with MS Echange email server
Code:
Imports System.Web.Mail<br />
<br />
'These 3 were added while I was debugging the problem, but they don't seem to help<br />
Imports CDO <br />
Imports MAPI <br />
Imports MSMAPI<br />
.<br />
.<br />
Dim MailMsg As System.Web.Mail.MailMessage<br />
Dim MailSrvr As System.Web.Mail.SmtpMail<br />
.<br />
.<br />
.<br />
.<br />
MailMsg = New System.Web.Mail.MailMessage()<br />
MailMsg.From = "from@email"<br />
MailMsg.Body = "Test Message!"<br />
MailMsg.Subject = "HI"<br />
MailMsg.To = "to@email"<br />
Try<br />
MailSrvr.Send(MailMsg)<br />
Catch err As Exception<br />
Debug.WriteLine(err.Message)<br />
End Try
Without fail, I get the error message. It seems to me that the code is right, but I must be missing a service or config somewhere. I've searched high and low on the web, MSDN, and .NET's sorry documentation but can't find out what's up.
Any ideas?
|
|
|
|
|
Have you set the MailSrvr.SmtpServer property yet??. You need to set it to the IP of your Mail Server.
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
Thank you for your help. It seems so obvious , but none of the examples or references I had found, actually said that. I set it to the name of our mail server, and it worked.
|
|
|
|
|
txtFind is a textbox that is used for search purposes (ie if a value is entered and the text box looses focus, a grid appears displaying a range of results). However, if no value is entered and it looses focus, i want the focus to be set on another text box:
If txtFind.Text = "" Then
txtCustomerCode.SetFocus
Exit Sub
End If
However, this generates the error: "Invalid procedure call or argument", is there anything i can do to alleviate this? thanks in advance for any help!let me know if any additional detail is required.
|
|
|
|