|
the only situation I can think of is when formB is a modal form and it's answer will dictate what formA will do...
dim oFrm as formB
If oFrm.showdialog() = DialogResult.OK Then
'change the state of formA
.
.
.
if they are independent of each other then I would agree...
|
|
|
|
|
nlarson11 wrote: when formB is a modal form and it's answer will dictate what formA will do...
Then FormB exposes it's status as properties. FormA then decides what it's going to do with that data and alters its own user interface accordingly. FormB should never know anything about the form that launched it.
|
|
|
|
|
I think we missed/missing each other's points.
if i'm in formA and I create and instance of formB, I have 2 options of displaying formB... SHOW and SHOWDIALOG if i use SHOW then you are correct, formB shouldn't need to know anything about A but if it does, use a delegate. if I use SHOWDIALOG that A is waiting for B to respond with the user's choice of pressing OK or Cancel or whatever choices remain in the enum dialogresult. So B will return the answer and A reacts accordingly. No different then an OK/Cancel messagebox. I personally have no issue with A reacting to B in this situation...
|
|
|
|
|
Whoops! Sorry, I misread your previous post. We're both on the same page!
|
|
|
|
|
good. i normally agree with you 100%
|
|
|
|
|
Hi,
this is a way that you can use if you are calling formB from formA, if not you can use the Sub Main to keep active forms references.
In FormB
Private m_f As FormA
Public Sub New(f as FormA)
m_f = f
MyBase.New
End Sub
...
Call m_f.TheMethod
In FormA
...ButtonX.Click
Call TheMethod
End Sub
Public Sub TheMethod
...
End Sub
...
dim f as New FromB(Me)
f.Show
Hope this helps!
NajiCo http://www.InsideVB.NET[^]
It's nice 2b important, but it's more important 2b nice...
|
|
|
|
|
Is there any way to run the application developed in VB.net 2005 on Linux or Mac OS . I have heard that there are some wrapper applications which make it possible. Any one who has done this or tried for this ?
Regards
|
|
|
|
|
|
The only way to run an application developed on Windows under Linux is to run it under a Windows emulator, such as Wine[^].
|
|
|
|
|
Hello There
My application is running in an environment where security policy does not allow the application to create folder on d drive. but my Application does have the Administrator UserName and Password. I want to create folder using Admin Credentials or you can say my application should run with Admin Rights no matter what ever the rights are for the logged on user.
Any helpful code or any Arcticle link would be highly appreciated.
Regards
|
|
|
|
|
Found this code, its not tested but gives you a pointer in imperonating another user.
Imports System
Imports System.Runtime.InteropServices
Imports System.Security.Principal
Imports System.Security.Permissions
<Assembly:SecurityPermissionAttribute(SecurityAction.RequestMinimum,
UnmanagedCode := true)>
Public Class Impersonation
<DllImport("C:\\WINNT\\System32\\advapi32.dll")> _
Public Shared Function LogonUser(lpszUsername As String, lpszDomain As
String, lpszPassword As String, _
dwLogonType As Integer, dwLogonProvider As Integer, ByRef
phToken As Integer) As Boolean
End Function
<DllImport("C:\\WINNT\\System32\\Kernel32.dll")> _
Public Shared Function GetLastError() As Integer
End Function
Public Shared Sub Main(args() As String)
'The Windows NT user token.
Dim token1 As Integer
'Get the user token for the specified user, machine, and password
using the unmanaged LogonUser method.
'The parameters for LogonUser are the user name, computer name,
password,
'Logon type (LOGON32_LOGON_NETWORK_CLEARTEXT), Logon provider
(LOGON32_PROVIDER_DEFAULT),
'and user token.
Dim loggedOn As Boolean = LogonUser("bob", "AARDVARK", "coffee", 3, 0,
token1)
Console.WriteLine("LogonUser called")
'Call GetLastError to try to determine why logon failed if it did not
succeed.
Dim ret As Integer = GetLastError()
Console.WriteLine("LogonUser Success? " + loggedOn)
Console.WriteLine("NT Token Value: " + token1)
If ret <> 0 Then
Console.WriteLine("Error code (126 == ""Specified module could not
be found""): " + ret)
End If
'Starting impersonation here:
Console.WriteLine("Before impersonation:")
Dim mWI1 As WindowsIdentity = WindowsIdentity.GetCurrent()
Console.WriteLine(mWI1.Name)
Console.WriteLine(mWI1.Token)
Dim token2 As IntPtr = new IntPtr(token1)
Console.WriteLine("New identity created:")
Dim mWI2 As WindowsIdentity = new WindowsIdentity(token2)
Console.WriteLine(mWI2.Name)
Console.WriteLine(mWI2.Token)
'Impersonate the user.
Dim mWIC As WindowsImpersonationContext = mWI2.Impersonate()
Console.WriteLine("After impersonation:")
Dim mWI3 As WindowsIdentity = WindowsIdentity.GetCurrent()
Console.WriteLine(mWI3.Name)
Console.WriteLine(mWI3.Token)
'Revert to previous identity.
mWIC.Undo()
Console.WriteLine("After impersonation is reverted:")
Dim mWI4 As WindowsIdentity = WindowsIdentity.GetCurrent()
Console.WriteLine(mWI4.Name)
Console.WriteLine(mWI4.Token)
End Sub
End Class
|
|
|
|
|
Thanks will let you know the output as soon as I shall test this.
Regards
|
|
|
|
|
Hello,
I have a datagridview that is bound to a bindingsource.
I have the binding source filter to only display 'ordered' rows. However, I have a combo box in the datagridview that will list 'ordered', 'to be ordered' and 'delivered'.
However, as the datagridview is filter to only display 'ordered' rows, as soon as the user selects either 'to be ordered' or 'delivered' it will automatically filter those rows. However, the customer wants to change all the displayed rows to 'delivered' then click save so all the rows will filter at that time.
Currently the row will disappear as soon as the combo box is selected to something.
I did try to use the suspendbinding, but that doesn't work for the dgv. I thought that might suspend the binding so the filter won't take place until after the user clicks the save button.
here is some code:
Many thanks for any help,
<br />
Try<br />
<br />
Me.bsOrderDetailsPending.Filter = String.Format("Status = '{0}' AND OrderID = '{1}'", "Ordered", Me.cboPendingOrders.SelectedValue)<br />
Me.dgvPendingOrders.AutoGenerateColumns = False<br />
Me.dgvPendingOrders.DataSource = Me.bsOrderDetailsPending<br />
Catch ex As Exception<br />
MsgBox(ex.Message)<br />
End Try<br />
|
|
|
|
|
I think you are going to have to rethink how the program is going to work behind the scenes. You will need a new field that will store the status you want to change it to. So you will filter by the status it currently is...and then when they click save, you will change the current status to the new status.
Hope this helps.
|
|
|
|
|
Hello,
Thanks for the reply.
However, that is not really the solution I was looking for.
The only thing i have found out is to do this:
<br />
Me.bsOrderDetailsPending.RaiseListChangedEvents = False<br />
however, by doing this the datagridview doesn't work as well.
Thanks for any more suggestions,
Steve
|
|
|
|
|
i had to add a help file...can any one guide me how to create help files in windows application
thank u
|
|
|
|
|
|
Hi
I have the following function which takes a very large input string from my asp page and passes it into a stored procedure, it all compiles a runs correctly through to executing a the query where it throws the exception - input string was not in correct format
any help much appreciated
boyindie
this is the code for my procedure
DELIMITER $$<br />
CREATE DEFINER=`jshort`@`localhost` PROCEDURE `sp_insert`(IN p_firstname varchar(20) ,IN p_middlename varchar(30), IN p_lastname VARCHAR(20),IN p_email VARCHAR(200),IN p_telNO INTEGER(16),IN p_mobNo INTEGER(16),IN p_faxNo INTEGER(16),IN p_houseName varchar(50), in p_houseNo Int(4), in p_strAdr varchar(200), in p_stradr1 varchar(200),in p_stadr2 varchar(200), in p_city varchar(50), in p_area varchar(50), in p_country varchar(50),in p_postcode integer(12))<br />
BEGIN<br />
<br />
Insert into user_details(user_Firstname, user_middleName, user_LastName, user_email, user_fax, user_tel, user_mobile) Values (p_firstname, p_middlename, p_lastname, p_email, P_telNo,P_mobNO,P_faxNo);<br />
<br />
INsert into user_addresses(address_house_name, address_house_no, address_address, address_extra1, address_extra2, address_city, address_area, address_county, address_postcode) VALUES (p_housename, p_houseNo, p_strAdr, p_strAdr1, p_strAdr2, p_city, p_area, p_country, p_postCode);<br />
<br />
END $$<br />
DELIMITER ;<br />
<br />
<br />
and I have the following code for inputing into
<br />
'Set command string to equal SPROC<br />
cmdString.CommandText = "sp_Insert"<br />
'ONLY PLACE THIS IF SPROC, sets the command to a SPROC<br />
cmdString.CommandType = CommandType.StoredProcedure<br />
<br />
Dim param As New MySqlParameter<br />
'Creats paramter to send to SPROC<br />
param = cmdString.Parameters.Add("?p_firstname", MySqlDbType.VarChar)<br />
'Sets parameter type to input parameter<br />
param.Direction = ParameterDirection.Input<br />
'Sets parameter value to text box<br />
param.Value = txtFirstname.Text<br />
<br />
'Creats paramter to send to SPROC<br />
param = cmdString.Parameters.Add("?p_middlename", MySqlDbType.VarChar)<br />
'Sets parameter type to input parameter<br />
param.Direction = ParameterDirection.Input<br />
'Sets parameter value to text box<br />
param.Value = txtMiddleName.Text<br />
<br />
'Creats paramter to send to SPROC<br />
param = cmdString.Parameters.Add("?p_lastname", MySqlDbType.VarChar)<br />
'Sets parameter type to input parameter<br />
param.Direction = ParameterDirection.Input<br />
'Sets parameter value to text box<br />
param.Value = txtLastName.Text<br />
<br />
'Creats paramter to send to SPROC<br />
param = cmdString.Parameters.Add("?p_email", MySqlDbType.VarChar)<br />
'Sets parameter type to input parameter<br />
param.Direction = ParameterDirection.Input<br />
'Sets parameter value to text box<br />
param.Value = txtEmail.Text<br />
<br />
'Creats paramter to send to SPROC<br />
param = cmdString.Parameters.Add("?p_telNo", MySqlDbType.Int64)<br />
'Sets parameter type to input parameter<br />
param.Direction = ParameterDirection.Input<br />
'Sets parameter value to text box<br />
param.Value = txtTelNo.Text<br />
<br />
'Creats paramter to send to SPROC<br />
param = cmdString.Parameters.Add("?p_mobNo", MySqlDbType.Int64)<br />
'Sets parameter type to input parameter<br />
param.Direction = ParameterDirection.Input<br />
'Sets parameter value to text box<br />
param.Value = txtMobNo.Text<br />
<br />
'Creats paramter to send to SPROC<br />
param = cmdString.Parameters.Add("?p_faxNo", MySqlDbType.Int64)<br />
'Sets parameter type to input parameter<br />
param.Direction = ParameterDirection.Input<br />
'Sets parameter value to text box<br />
param.Value = txtFaxno.Text<br />
<br />
'Creats paramter to send to SPROC<br />
param = cmdString.Parameters.Add("?p_houseName", MySqlDbType.VarChar)<br />
'Sets parameter type to input parameter<br />
param.Direction = ParameterDirection.Input<br />
'Sets parameter value to text box<br />
param.Value = txtHouseName.Text<br />
<br />
'Creats paramter to send to SPROC<br />
param = cmdString.Parameters.Add("?p_houseNo", MySqlDbType.Int64)<br />
'Sets parameter type to input parameter<br />
param.Direction = ParameterDirection.Input<br />
'Sets parameter value to text box<br />
param.Value = txtHouseNo.Text<br />
<br />
'Creats paramter to send to SPROC<br />
param = cmdString.Parameters.Add("?p_StrAdr", MySqlDbType.VarChar)<br />
'Sets parameter type to input parameter<br />
param.Direction = ParameterDirection.Input<br />
'Sets parameter value to text box<br />
param.Value = txtStreetAdd.Text<br />
<br />
'Creats paramter to send to SPROC<br />
param = cmdString.Parameters.Add("?p_strAdr1", MySqlDbType.VarChar)<br />
'Sets parameter type to input parameter<br />
param.Direction = ParameterDirection.Input<br />
'Sets parameter value to text box<br />
param.Value = txtAdressE1.Text<br />
<br />
'Creats paramter to send to SPROC<br />
param = cmdString.Parameters.Add("?p_stAdr2", MySqlDbType.VarChar)<br />
'Sets parameter type to input parameter<br />
param.Direction = ParameterDirection.Input<br />
'Sets parameter value to text box<br />
param.Value = txtAdressE2.Text<br />
<br />
'Creats paramter to send to SPROC<br />
param = cmdString.Parameters.Add("?p_city", MySqlDbType.VarChar)<br />
'Sets parameter type to input parameter<br />
param.Direction = ParameterDirection.Input<br />
'Sets parameter value to text box<br />
param.Value = txtCity.Text<br />
<br />
'Creats paramter to send to SPROC<br />
param = cmdString.Parameters.Add("?p_country", MySqlDbType.VarChar)<br />
'Sets parameter type to input parameter<br />
param.Direction = ParameterDirection.Input<br />
'Sets parameter value to text box<br />
param.Value = txtCountry.Text<br />
<br />
'Creats paramter to send to SPROC<br />
param = cmdString.Parameters.Add("?p_area", MySqlDbType.VarChar)<br />
'Sets parameter type to input parameter<br />
param.Direction = ParameterDirection.Input<br />
'Sets parameter value to text box<br />
param.Value = txtArea.Text<br />
<br />
'Creats paramter to send to SPROC<br />
param = cmdString.Parameters.Add("?p_postcode", MySqlDbType.VarChar)<br />
'Sets parameter type to input parameter<br />
param.Direction = ParameterDirection.Input<br />
'Sets parameter value to text box<br />
param.Value = txtPostCode.Text<br />
<br />
<br />
<br />
<br />
'Insert the records into the database<br />
connection.Open() 'Opens Database Connection<br />
cmdString.ExecuteNonQuery() 'Executes procedure<br />
connection.Close() 'Closes connection<br />
<br />
Catch ex As Exception<br />
litErr.Text = ex.Message<br />
MsgBox(ex.Message) 'Shows error message as messagebox<br />
<br />
End Try<br />
End Sub<br />
<br />
|
|
|
|
|
PROBLEM SOLVED WAS MULTITUDE OF ERRORS
|
|
|
|
|
hi i cant find the query builder in visual basic express edition could someone point me in the right direction 2 find it cheers
|
|
|
|
|
Query Builder doesn't show up as a seperate option. You will only get that option in a place where it is appropriate, usually in one of the dialogs, for say, creating a DataSet or TableAdapter.
|
|
|
|
|
if i have 2 forms ...
at first i am accesing 1 form and minised...at the same time shall i open another form...
please send the code soon
if anybody knows
thanks & regards.
|
|
|
|
|
What exactly is your question/ problem???
Regards,
Nilesh.
|
|
|
|
|
May i have please more specific question.?
|
|
|
|
|
Hi,
It seems that you are planning to build a switch menu, if this is the case:
This is a tricky way
In form 1 > Button (or whatever):
Dim f as New Form2
Me.Hide
f.ShowDialog
Me.Show
Hope this will help
NajiCo http://www.InsideVB.NET[^]
It's nice 2b important, but it's more important 2b nice...
|
|
|
|
|