|
So you want to use the API and not a call to the Net.exe executable? Easy with a call to the shell app. I don't know how to access the API for that if there is one.
Thanks,
Taen Karth
|
|
|
|
|
Hello,
I don't want to use external "exe" file with a shell.
The NetShareEnum API is create specially for list share on remote computer.
For all these reasons I would like to use this API.
But If nobody show me the way, I think I will use your solution.
Thanks for your help
|
|
|
|
|
There are a couple of samples on the web, even one here on CodeProject. Have a look at this[^]. It in C#, but the code can be converted to VB.NET with reasonable effort.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I want to make a property for my custom control with name "RelatedLabel" that sets or gets a Windows Forms Label Control.
How do I list all the Label Controls (names) in the Form in a Property window in the design time.
Such as AcceptButton or CancelButton property of Windows Form.
I hope u understand my question
Thank You
-- modified at 12:30 Thursday 1st September, 2005
|
|
|
|
|
When you expose a public property that is of type Button, Label, Text, ScrollBar, etc, Visual Studio automatically lists all the controls of your property type available in the form at design time.
|
|
|
|
|
It really works.
Thank You.
|
|
|
|
|
Is there an event that runs right after the form is displayed for the first time?
I would like to show my form with no data displayed on it, then display a login screen on top of it. After correct login and password populate form with data.
Thanks.
|
|
|
|
|
Yes Use the forms "OnLoad" event
Just double click anywhere on your blank form in the IDE and it will send you to the "OnLoad" event for that form.
Thanks,
Taen Karth
|
|
|
|
|
The problem with the onload event is that it fires before the form is displayed. I want an event that fires right after the form is displayed for the first time.
|
|
|
|
|
There is no event that fires one-time only after the form is displayed.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
There is no event that is fired one-time only right after the form is displayed.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ok, how do I accomplish this:
The app starts. The user sees the main form with all of its controls but without any data population. A login form also appears on top of this form. After typing a valid username and password the login form goes away and the main form is populated with data.
What I need help with is where in the main form do I call the login form. Thanks
|
|
|
|
|
I guess I don't understand exactly what you are trying to accomplish.
I have an MDI application that displays the main form before firing the onload event. My login form in in the main forms' "OnLoad" event so it looks like this:
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
<br />
frmLogin.StartPosition = FormStartPosition.CenterScreen<br />
frmLogin.ShowDialog()<br />
<br />
End Sub
Then my login screen shows in the middle of the screen and in dialog mode so that it has to be responded to before the user can access the main form.
|
|
|
|
|
Is your main form displaying behind the login form?
In your example you call the login form from the load event of the main form. When the main form load event fires the main form is not yet visible on the screen. Your login form is displayed as a dialog and stops the main form from displaying until the login form closes.
I would like to have the main form displayed behind my login form. Its kind of like the way Outlook works. You click on the icon, you see the Outlook screen but the login screen is in front of it, preventing you from doing anything until you provide a correct user name and password.
|
|
|
|
|
dptalt wrote:
Is your main form displaying behind the login form?
You can't launch a modal form with ShowDialog from the Load event of another form and expect both forms to show up. You'll see the modal form, but not the form that launched it. This is because the form won't actually show up until it's Load event is completed. Which, in your case, won't happen until the login form closes and control is returned to the line after your ShowDialog call.
In Outlook, the login is not controlled by the main form. Rather is being controller by a component that manages the data store Outlook uses.
In your application, you can't use ShowDialog to launch a login form. What you probably need to do is create your main form so it creates an object that wraps your datastore. When your controls are put up, they have to check to see if a user is logged in or not. If not, grey out the control or whatever you want.
But, when you actually have to get to the data, you call this component and it will put up the modal login form if it needs to, not your main form. If you want to update the status of your controls based on the existance of a valid login or not, you can then do that in the main form's Activated event.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
It works fine for me. Just set you main form "Window State" to "Maximized" and then you can use the logon.showdialog in the main forms Load event and it will appear in front of the Main form but both will display. Code follows
Main Form w/ WindowState property set to "Maximize"
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.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Name = "Form1"
Me.Text = "Main Form!!"
Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
End Sub
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim frm As New Form2
frm.StartPosition = FormStartPosition.CenterScreen
frm.ShowDialog()
End Sub
End Class
Login Form
Public Class Form2
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
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(208, 232)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 0
Me.Button1.Text = "Login"
'
'Form2
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.Add(Me.Button1)
Me.Name = "Form2"
Me.Text = "Login"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Dispose()
End Sub
End Class
Hope that helps everyone.
Thanks,
Taen Karth
|
|
|
|
|
sorry for replying in the center if you problem is not solved then there is a solution for you. You have many variables in your application. May be one of them is UserID. you can check that in Activate event of main form
' any variable which you set, when user logs on.
' where is 0 is user has not signed in yet
if userID=0 then
dim frm as new LogOnForm
frm.showDialog
' do some thing if required
end if
and offcourse once the user is logged on then UserID <>0 so it will never show the logon form again.
|
|
|
|
|
Hey,
I used the following code, in a separate class
which contains "sub main" (this you need to start application)
I used it to show a loginform with behind it a background picture(frmbackground) after the login succeed I close all forms and call
my application.
Explanation by code
3 form's : Parent,Login,Background
Friend Class AppMgr
<STAThread()> _
Shared Sub main()
Dim frmbackground As New background
Dim frmlogin As New Login
frmbackground.Show()
If frmlogin.ShowDialog = DialogResult.OK Then
frmbackground.Close()
Dim frmparent As New Parent
Application.Run(frmparent)
End If
End Sub
Maybe this is helpfull
I listen, I learn, I deliver.
|
|
|
|
|
The Activated event is triggered after the load (and every time the form is activated)
One can use a flag (to indicate first activation) and the activated event to solve the problem.
class form
inherits Windows.System.Forms.Form
...
Private _firstActivation as boolean = true
Private Sub frmMain_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated
If (_firstActivation) Then
_firstActivation = False
Dim frm As New Login
Dim res as DialogResult = frm.ShowDialog(me)
' Login Succeeded / Failed functionality
End If
End Sub
...
end class
hth,
Q.
|
|
|
|
|
If you open your login screen like this:
frmMain.Show 'Displays frmMain
frmLogin.Show vbModal 'Displays Login form
It should act like a message box, not allowing the user to access any other form.
Hope this helps.
|
|
|
|
|
I have created a button that when clicked would like it to allow me to embed a word file to the page becasue I want to give a user the option to attatch information based on a question to a word form. Any help would be great. I dont know any VB code either huh!!
|
|
|
|
|
Let me see if I understand what you are asking correctly. You have an app that asks the user a question. You would like the user to be able to click on a button that would bring up a blank Word processor page so that the user can input information and have it stored next to the question? Am I way off?
Thanks,
Taen
|
|
|
|
|
Sorry if im confusing you a little. I would like to have a button on a form that when the user clicks on it, brings up a file attatchment window so the user can select to embed the new object to the page. In word if you go to Insert > Object it gives you options to embed a document. What the problem is, is that when you protect a form in word it revokes these controls hence not allowing the user to do it manually by way of me telling them using comment boxes on the form, instead I would like a button that can open this window. Thanks for your help.;)
chris
|
|
|
|
|
So when the user attaches the Word doc do you want it displayed or just a placeholder icon like and attachment that when double click will open the doc?
Sorry for so many questions...
Thanks,
Taen Karth
|
|
|
|
|
just a placeholder icon like and attachment that when double click will open the doc? If it is possible yeah
Cheers
Chris
|
|
|
|