|
How do i change the ShowWithoutActivation property for my form and mke it so that when my form shows, it doesn't steal focus.
Posted by The ANZAC
|
|
|
|
|
ShowWithoutActivation is a read-only property. You can set form’s TopMost property to True, if you like to show your form without activation.
|
|
|
|
|
i am using a datagrid and if currently i am in a row of datagrid and i want raise an event of datagrid row becoze there is not predefined event for the row of grid. focus is on grid row how i will use key press event plz tell me.
|
|
|
|
|
I am getting this error when I run the program. I am not sure how to fix this error, if anybody can help me I will appreciate it. The program has two forms. Form1 has the search textbox and form2 takes the information from form1 and populates form2. I have attached the code for both forms, so you can see what I am talking about. Any help will be appreciated. Thanks
Form1 Code:
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click<br />
Dim oForm2Data As New Form2.Form2Data(Me.txtbarcodeid.Text)<br />
<br />
If oForm2Data.HasData Then<br />
<br />
Form2.Initialize(Me, oForm2Data)<br />
<br />
Else<br />
' The Data does not exists for the item in the textbox<br />
<br />
End If<br />
End Sub<br />
Form2 Code:
Dim dt As New DataTable<br />
Dim sqlStr As String = "SELECT * FROM testbackup"<br />
Dim sqlstr1 As String = "SELECT * FROM history"<br />
Dim connstr As String = "Provider = Microsoft.Jet.OLEDB.4.0;" & _<br />
"Data Source = backup.mdb"<br />
Dim dataadapter As New OleDb.OleDbDataAdapter(sqlStr, connstr)<br />
<br />
Public Shared Sub Initialize(ByVal Owner As IWin32Window, ByRef oForm2Data As Form2Data)<br />
Dim result As DialogResult<br />
Dim frm2 As New Form2<br />
<br />
With frm2<br />
'Using TheData Populate each Control on Form2<br />
End With<br />
<br />
Result = frm2.ShowDialog(Owner)<br />
<br />
If Result = System.Windows.Forms.DialogResult.OK Then<br />
<br />
<br />
With frm2<br />
'Now update the values in TheData with its value in its Form2 Control<br />
End With<br />
<br />
'Save Changes<br />
oForm2Data.SaveData()<br />
End If<br />
<br />
End Sub<br />
<br />
Public Class Form2Data<br />
Public HasData As Boolean<br />
Public TheData As DataRow<br />
<br />
Public Sub New(ByVal Value As String)<br />
Dim dsData As DataSet<br />
Dim stSQL As String<br />
<br />
stSQL = "Select * from testbackup Where barcodeid = '" & Value & "'"<br />
<br />
'Database code to return dataset to dsData<br />
<br />
<br />
Select Case dsData.Tables(0).Rows.Count<br />
Case 1 'One Row Returned<br />
HasData = True<br />
TheData = dsData.Tables(0).Rows(0)<br />
Case 0 'No Rows Found<br />
HasData = False<br />
TheData = Nothing<br />
Case Else 'More then one row returned<br />
'Decided how to handle<br />
HasData = True<br />
TheData = dsData.Tables(0).Rows(0)<br />
End Select<br />
<br />
<br />
End Sub<br />
<br />
Public Sub SaveData()<br />
'Routine to save the data<br />
End Sub
|
|
|
|
|
Where is the exception being thrown?
Mike Lasseter
|
|
|
|
|
at this statement
Select Case dsData.Tables(0).Rows.Count
|
|
|
|
|
I don't see where dsData is getting Initialized. Is your database code working?
Mike Lasseter
|
|
|
|
|
which database code. I am not sure which one. I wanted to post my program here, but I don't know how to do that. Can you tell me where to initialize my dsdata
|
|
|
|
|
<br />
Dim dsData As DataSet '--THIS VARIABLE IS NOT GETTING INITIALIZED/SET<br />
Dim stSQL As String<br />
<br />
stSQL = "Select * from testbackup Where barcodeid = '" & Value & "'"<br />
<br />
'THIS IS DB CODE I AM TALKING ABOUT<br />
'Database code to return dataset to dsData<br />
<br />
Without seeing the code I can't say exactly where your problem is, but here are some things to check.
1. Is the dsData nothing when you step through your code?
2. If not does it contain any tables?
My guess is the dsData is not getting populated correctly in the Database Code
Mike Lasseter
|
|
|
|
|
can i e-mail you my program, so you can see what is happening. let me know. thanks for your help so far
|
|
|
|
|
Just post the code for 'Database code to return dataset to dsData in the forum. It shouldn't be that long.
Mike Lasseter
|
|
|
|
|
I am not sure what to put in that area. Would you be able to help me with that if you don't mind. thanks
|
|
|
|
|
|
Alright I looked at the website and this is what I got out of it. This is what I have so far, but when I run the program now I don't get anything. It does not go to form2. It just stays at form1 even when I hit the search button. I must have done something wrong and I can't figure out. I am trying my best to figure out. Any help will be appreciated. Thanks again
Public Sub New(ByVal Value As String)<br />
Dim dsData As DataSet = New DataSet("BackupInfo")<br />
Dim stSQL As String<br />
Dim backupTable As DataTable = dsData.Tables.Add("testbackup")<br />
<br />
stSQL = "Select * from testbackup Where barcodeid = '" & Value & "'"<br />
<br />
'Database code to return dataset to dsData<br />
<br />
<br />
backupTable.Columns.Add("Barcodeid", Type.GetType("System.Int32"))<br />
backupTable.Columns.Add("location", Type.GetType("System.Int32"))<br />
backupTable.Columns.Add("datein", Type.GetType("System.String"))<br />
backupTable.Columns.Add("dateout", Type.GetType("System.String"))<br />
backupTable.Columns.Add("timein", Type.GetType("System.String"))<br />
backupTable.Columns.Add("timeout", Type.GetType("System.String"))<br />
backupTable.Columns.Add("comment", Type.GetType("System.String"))<br />
<br />
Select Case dsData.Tables(0).Rows.Count<br />
Case 1 'One Row Returned<br />
HasData = True<br />
TheData = dsData.Tables(0).Rows(0)<br />
Case 0 'No Rows Found<br />
HasData = False<br />
TheData = Nothing<br />
Case Else 'More then one row returned<br />
'Decided how to handle<br />
HasData = True<br />
TheData = dsData.Tables(0).Rows(0)<br />
End Select<br />
<br />
<br />
End Sub
-- modified at 16:57 Saturday 22nd July, 2006
|
|
|
|
|
|
Alright. I finally made progress with your help. thanks a lot. But now when I run the program I get the message that I put in "not valid". It is not picking up the record. This is the code I have so far. Any help will be appreciated. Thanks
Public Sub New(ByVal Value As String)<br />
Dim dsData As DataSet = New DataSet1<br />
Dim stSQL As String<br />
Dim backupTable As DataTable = dsData.Tables.Add("testbackup")<br />
<br />
stSQL = "Select * from testbackup Where barcodeid = '" & Value & "'"<br />
<br />
'Database code to return dataset to dsData<br />
<br />
<br />
Dim orderConn As OleDb.OleDbConnection = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _<br />
"Data Source=backup.mdb;")<br />
Dim orderDA As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter("SELECT * FROM testbackup", orderConn)<br />
<br />
<br />
orderConn.Open()<br />
<br />
Dim custDS As DataSet = New DataSet<br />
<br />
<br />
orderDA.Fill(custDS, "testbackup")<br />
<br />
orderConn.Close()<br />
<br />
backupTable.Columns.Add("Barcodeid", Type.GetType("System.Int32"))<br />
backupTable.Columns.Add("location", Type.GetType("System.String"))<br />
backupTable.Columns.Add("datein", Type.GetType("System.String"))<br />
backupTable.Columns.Add("dateout", Type.GetType("System.String"))<br />
backupTable.Columns.Add("timein", Type.GetType("System.String"))<br />
backupTable.Columns.Add("timeout", Type.GetType("System.String"))<br />
backupTable.Columns.Add("comment", Type.GetType("System.String"))<br />
<br />
Select Case dsData.Tables(0).Rows.Count<br />
Case 1 'One Row Returned<br />
HasData = True<br />
TheData = dsData.Tables(0).Rows(0)<br />
Case 0 'No Rows Found<br />
HasData = False<br />
TheData = Nothing<br />
Case Else 'More then one row returned<br />
'Decided how to handle<br />
HasData = True<br />
TheData = dsData.Tables(0).Rows(0)<br />
End Select<br />
<br />
<br />
End Sub
This is the code where it says not value.
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click<br />
Dim oForm2Data As New Form2.Form2Data(Me.txtbarcodeid.Text)<br />
<br />
If oForm2Data.HasData Then<br />
<br />
Form2.Initialize(Me, oForm2Data)<br />
<br />
Else<br />
' The Data does not exists for the item in the textbox<br />
MsgBox("Not valid")<br />
End If<br />
End Sub
|
|
|
|
|
i have experienced like this one too.
the problem was the data type. How come???
let see your code below :
stSQL = "Select * from testbackup Where barcodeid = '" & Value & "'"
if we see at barcodeid = '" & Value & "'" , we can say that barcodeid is string data type.
But it's possible in your datasource, the barcodeid is integer..
so the solution is remove ' charachters, and it will be like this:
stSQL = "Select * from testbackup Where barcodeid = " & Value
-- modified at 7:43 Friday 4th August, 2006
|
|
|
|
|
hiiii all
please i need to find the hard disk (volume) serial number,
the number that is given to the hard disk from manufacturer not the one that changes after formating the hard disk.
can anyone help me to this in VB.Net please
mayoush
|
|
|
|
|
Windows Management Instrumentation (WMI)
|
|
|
|
|
You can also try this code
<br />
Dim moReturn As Management.ManagementObjectCollection<br />
Dim moSearch As Management.ManagementObjectSearcher<br />
Dim mo As Management.ManagementObject<br />
moSearch = New Management.ManagementObjectSearcher("Select * from Win32_PhysicalMedia")<br />
moReturn = moSearch.Get<br />
For Each mo In moReturn<br />
MsgBox(Trim(mo("SerialNumber")))<br />
Next<br />
regards
Mubashir
|
|
|
|
|
hi
thx for your help,
but the VB.Net didn't recognize the "Management.ManagementObjectCollection"
do i need to import anything for it to work?
thx again for your help;)
i do Appritiate it
|
|
|
|
|
You need to import System.Management
You have to select
Project Menu --> Add Reference --> .NET tab --> System.Manegement
|
|
|
|
|
it did work
thx a lot
|
|
|
|
|
I'm taking a VB.Net course. I've written several ASP.Net apps. My employer gave me a new PC with Windows XP and now I can not get into any of the programs I wrote, all were working on the old PC.
The message is:
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
It points to this line of code in the webconfig file:
<authentication mode="Windows">
On both the old and the new PC my code is on the C drive in INETPUB/WWWROOT
|
|
|
|
|
open your IIS . right click on the project folder and click properties. Press the Create Button on the pop window selected tab. click ok and try now it will work.
Rizwan Bashir
|
|
|
|