|
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
|
|
|
|
|
I would you the OpenFileDialog contrl to go find the file and then once selected I would either insert it into the database, assuming you have a backend database design, or I would add it as a LinkLabel or PictureBox with a link to the external file.
Does that help?
Thanks,
Taen Karth
|
|
|
|
|
I do not have a database only as word file and want to create an embedded document on the page so when clicked upon it opens this file. Im word you can go to Insert>Object and here select the file to attatch to the word document. It then creates a link in the page. My problem is that when I protect the form, this option is not available to me from the insert menu so I have placed a button on the page and would like to know if it is possible to add code that will open the Insert>object dialog box. when I click on the button it gives me this code
Private Sub CommandButton1_Click()
End Sub
|
|
|
|
|
Agh! My sample code uses 'Type', but VS.NET tells me it is no longer supported - I am to use 'Structure' instead. So I need help converting this from type to structure:
Type tServerType = Type.GetTypeFromProgID("WMSServer.Server", <server>);
Help?
________________________________________________________________________
Dave
Y10K bug! Let's not get caught with our pants down **AGAIN**! (DC 02002)
|
|
|
|
|
That's not going to work. Type.GetTypeFromProgId will always return a Type, not a structure. There is no way to convert one to a structure either.
If you use Type.GetTypeFromProgId on a COM server, like "Scripting.FileSystemObject", it will always return a type of System.__ComObject . What are you trying to do with this?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The code is copied verbatim from the microsoft site:
http://msdn.microsoft.com/library/en-us/wmsrvsdk/htm/creatingaspserverobj.asp?frame=true
---
// Create a remote WMSServer object from a System.Type object and
// the CreateObject method.
Type tServerType = Type.GetTypeFromProgID("WMSServer.Server", "remote_server_name");
WMSServer wms = (WMSSServer)Server.CreateObject(tServerType);
// Create a remote WMSServer object from a System.Type object and a
// System.Activator object.
Type tServerType = Type.GetTypeFromProgID("WMSServer.Server", "remote_server_name");
WMSServer wms = (WMSServer)Activator.CreateInstance(tServerType);
---
(I realize this is ASP. I am confounded at the interplay between VB froms and ASP pages and the code on each. Half the samples I want are in ASP and half are in VB, and frankly I don't understand how the two work together in Visual Studio.)
In VB, a sample looks like this:
---
Imports Microsoft.WindowsMediaServices.Interop
Imports System.Runtime.InteropServices
Dim tServerType As Type
Dim RemoteServer As WMSServer
Try
tServerType = Type.GetTypeFromProgID("WMSServer.Server", "server_name")
' Create an instance of the remote server object locally.
RemoteServer = Activator.CreateInstance(tServerType)
---
but, no matter WHAT I try, I get 'access denied'. I have been configuring my systems for 5 days now.
________________________________________________________________________
Dave
Y10K bug! Let's not get caught with our pants down **AGAIN**! (DC 02002)
|
|
|
|
|
Do you have two servers for your app? One is the web server and the other is a media server with Window Media Services installed? Are they arranged in a domain environment or are they workgroup with each having it's own set of user accounts?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Two servers: one web, one media. Different domains. I could set them up in the same domain if you think thast would make things easier.
________________________________________________________________________
Dave
Y10K bug! Let's not get caught with our pants down **AGAIN**! (DC 02002)
|
|
|
|
|
DaveC426913 wrote:
Different domains
That's why you're getting "Access Denied". Your web code is running under the ASPNET account on one domain, who's SID does not exist in the other. Your best solution is to get both servers into the same domain.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
Iam tryin to create a macro that when run will open a window so I can attatch a file to a protected form within microsoft word. This is doing my head in now becasue Im not sure if it can be done or how and I have no knowledge of VB whatsoever. Any help would be much appreciated.
Many Thanks
|
|
|
|
|
Does Crystal Reports come with any versions of VB .NET?
|
|
|
|
|
I know that Enterprise Architect version comes with some Crystal reporting features but I don't think it is the full blown Crystal Reports.
Hope that helps...
|
|
|
|
|
Hi,
I have to update a program while it is working. First i stop the process of programme then i copy new files and restart the process of program.At this time i see 2 system tray icon of my programme. When i move mouse over them the killed process's icon removes itself. But i want it to be destroyed when i first kill it's process.Could someone help me plz?
--junior coder--
|
|
|
|
|
You can't remove th icon yourself since your application was stopped and/or terminiated by the debugger. There's no way to run any removal code for the icon if your code is no longer running. You just have to put the mouse over the orphaned icon and let it get kicked by the System Tray. No, there's no way to force the System Tray to do this.
Even if you could write an app to force the System Tray to clean itself up, wouldn't it just be quicker to pass the mouse over the Tray, instead of finding and double-clicking another icon?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
got a problem:
table in excel(with names A, B):
A B
----------
1 Hallo
1 wie geht es dir?
2 schlecht!
3 nein,
3 eigentlich gut!
I want the result:
A B Resultat C
-------------------------------------------
1----Hallo----------------
1----wie geht es dir?-----Hallo wie geht es dir?
2----schlecht!------------schlecht!
3----nein,----------------
3----eigentlich gut!------nein, eigentlich nicht
How does the makro-code look like????
Thank`s for helping!!!
nico
|
|
|
|