|
Sure - the real question is, why do you want to open every form modelessly ? I mean, what possible use is this ? You app has 30 different forms open, and no way of interacting with any of them. That's the core question I was asking you, why do that ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Sure - the real question is, why do you want to open every form modelessly ?
I mean, what possible use is this ?
Since im realatvly new to Vb.Net, i will ask you why not??
Main advatage is i dont need to declare a new form evry time i need to open it, instead of that i
just call a Windows Form from assambly and open it.
Im planing to have 6 projects in one solution, one project will be my main windows app in wich i will load all of my windows forms and display it to the user.(imagine the time lost if i need to
declare a new Windows Form evry time i need to open it, 6 projects > 70+ Windows Forms)
Your app has 30 different forms open, and no way of interacting with any of them.
How do you mean "no way of interacting with any of them" ??
I have now one main project(wich loks like outlook style app, and is my startup project) and in that project im adding particular form(from any of my projects) to my main panel (using controls.Add method) and displaying it to the user. So i have a good way to interact with the Windows form,
and the controls on it.
So now when you know what im planing to do, if you know/have any better solution, for the way to do it, im open for sugestions.
Tnx in advance.
Nihad.
|
|
|
|
|
C4ao5 wrote: Since im realatvly new to Vb.Net, i will ask you why not??
Because I can't imagine any real world reason to create a bunch of forms that my code cannot interact with again. Nor can I see any reason to have 30 forms on the screen at all.
C4ao5 wrote: Main advatage is i dont need to declare a new form evry time i need to open it, instead of that i
just call a Windows Form from assambly and open it.
If you want to create a form, doing it via reflection is a lot more work.
C4ao5 wrote: .(imagine the time lost if i need to
declare a new Windows Form evry time i need to open it, 6 projects > 70+ Windows Forms)
This is BS, sorry. Your app will run slower from using reflection.
C4ao5 wrote: How do you mean "no way of interacting with any of them" ??
Your 30 forms are like 30 different apps all running by themselves. None of them can cause any other form to behave differently.
C4ao5 wrote: So i have a good way to interact with the Windows form,
and the controls on it.
no. When you create a modeless form and do not store a reference to it, or even when you do, but it's a base Form, not the derived class, you have NO way of interacting with the controls on it in code, outside that form, ever again.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Ok, i understand your point, so what would you sugest when developing a solution with multiple projects ??
What is the best way to do it, if any ??
I would realy like to develop an outlook style app, in wich user can select an app wich he needs
for his/hers daily work....
Rgrds.
Nihad.
|
|
|
|
|
Well, in that case, I'd develop a plugin architecture, and define an interface all plugins could expose, so that you can add functionality beyond the base Form class. I'd then have a list of those plugin types, let the user open a plugin via the sort of mechanism you're using now, but to keep those open forms in a list, so you can interact with them via that common interface, as required.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Ok,
thank you for all of you help Christian.
|
|
|
|
|
Hi all!
I've Run into a problem in developing my latest VB App, how would you launch a console
window from a winform and write to and read from it using vb's ReadLine() and WriteLine()?
This is what i have so far:
Dim OutputConsole As Console
... Yep, that's it, i can't figure out how to actually show the console window, even thougn ( I think), it is actually there.
Thanks
MrWolfy
|
|
|
|
|
Hi,
I know of no way to add a visible Console to a Windows app.
AFAIK the only (easy) way to get a Console is by creating a "Console Application", which always
has a Console (which can be hidden after it has been shown initially) and which can
or can not behave as a regular Windows app, depending on your code.
|
|
|
|
|
Hi Again!
Thanks for your help, maybe i'll dress up a winform to look like a console window and
add a keylistener to run commands.
Thanks Again
MrWolfy
|
|
|
|
|
i have this two lines of code in a window service. it creates the directory but does not insert data into the database. both work in a window form project. pls i need help
Dim dailydirobj As DirectoryInfo = Directory.CreateDirectory("C:\ebube")
bllclass.InsertIncoming("filemu", "filegi", 0, "ayincha")
i have the funtion for DAL as
Public Function InsertIncoming(ByVal pfaAccount As String, ByVal myfileName As String, ByVal sent As Boolean, ByVal dNfNme As String) As Boolean
Dim params() As SqlParameter = {New SqlParameter("@pfaAccount", pfaAccount), _
New SqlParameter("@fileName", myfileName), _
New SqlParameter("@sent", sent), _
New SqlParameter("@FullPath", dNfNme)}
Try
Dim i As Integer = SqlHelper.ExecuteNonQuery(connectionString, CommandType.StoredProcedure, "InsertIncoming", params)
Return (i = 1)
Catch ex As Exception
Throw ex
End Try
End Function
and the store procedure as
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[InsertIncoming]
@pfaAccount varchar(50)
,@fileName varchar(150), @sent bit, @FullPath varchar(max)
as
INSERT INTO [diamonddb].[dbo].[Incoming]
([pfaAccount]
,[fileName], sent,FullPath)
VALUES
(@pfaAccount
,@fileName,@sent ,@FullPath)
|
|
|
|
|
Are you connected to the database? Any error messages?
|
|
|
|
|
no error message the service is running. where can i view window service run time error
i am connected to the database
|
|
|
|
|
i modify the code like this. but same problem help pls
Dim dailydirobj As DirectoryInfo = Directory.CreateDirectory("C:\ebube")
Dim ins As String = "INSERT INTO incoming([pfaAccount] ,[fileName], sent,FullPath) VALUES('ebube','fileName','0' ,'FullPath')"
Dim con As New SqlConnection("Data Source=PRGLAP11;Initial Catalog=diamonddb;Integrated Security=SSPI")
Dim com As New SqlCommand(ins, con)
con.Open()
com.ExecuteNonQuery()
con.Close()
|
|
|
|
|
I Don't like to debug Windows Services, therefore I always create seperate classes with all functionality I need and the test those on and on before calling the functions in those classes from a windows service.
|
|
|
|
|
i have include change integrated security but the problem persist. the connection string is
Dim con As New SqlConnection("Data Source=PRGLAP11;Initial Catalog=diamonddb;username = sa; password = eb")
|
|
|
|
|
If you put an stop statemnt in your code it should ask if you want to open the app in a debugger. Alternativly put a thread.sleep (for about 15 seconds) in the onstart code (to make your code wait) and attach to the process from the debug menu of the ide.
Hope this helps
Bob
Ashfield Consultants Ltd
|
|
|
|
|
when i put the thread it tell it cannot start the service. if i comment out the tread line and set break point at sub process mail. the service will start but when i point at break. i see a tooltip." the breakpoint will not currently be hit. no symbol have been loaded for this document.
pls hlp see the extract code below
Public Class testService
Private t As Timer
Dim log As New EventLog("Application", ".", "Diamond eMail Solution")
Dim cr, KeyID, sKeyID As Int32, afterLoad As Boolean
Dim panelIndex As Int32, insert As Boolean, ds As DataSet, bllclass As New baseTables, bllAdmin As New Administration
Dim myfileName As String
Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set things
' in motion so your service can do its work.
System.Threading.Thread.Sleep(15000)
Try
t = New Timer(2000)
AddHandler t.Elapsed, AddressOf TimerFired
With t
.AutoReset = True
.Enabled = True
.Start()
End With
Catch ex As Exception
log.WriteEntry(ex.Message, EventLogEntryType.Information)
End Try
End Sub
Protected Overrides Sub OnStop()
' Add code here to perform any tear-down necessary to stop your service.
t.Stop()
t.Dispose()
End Sub
'Protected Overrides Sub OnPause()
' t.Stop()
' MyBase.OnPause()
'End Sub
Private Sub TimerFired(ByVal sender As Object, ByVal e As ElapsedEventArgs)
'Working()
'getApplicationData()
ProcessMail()
End Sub
Sub ProcessMail()
'Try
Dim insert As Boolean
Dim dailydirobj As DirectoryInfo = Directory.CreateDirectory("C:\ebube")
Dim ins As String = "INSERT INTO incoming([pfaAccount] ,[fileName], sent,FullPath) VALUES('ebube','fileName','0' ,'FullPath')"
Dim con As New SqlConnection("Data Source=PRGLAP11;Initial Catalog=diamonddb;Integrated Security=SSPI")
Dim com As New SqlCommand(ins, con)
con.Open()
com.ExecuteNonQuery()
con.Close()
end sub
end class
|
|
|
|
|
You cannot debug a windows service directly from the ide as you cannot run a service from the ide. Install the service, then ATTACH from the debug menu.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
that is exactly what i deed
|
|
|
|
|
I can't tell because you didn't post the connection string, but the common problem in connecting to an SQL Server from a Windows Service is using Integrated Security. The Local System account has no permissions to SQL Server, so the connection will not work.
Best practice is to NOT use integrated security, unless absolutely necessary and, instead, create a user account in SQL Server that the Service will use to connect to SQL Server. This gives you much greater control over what that account can and cannot do in SQL, resulting in greater security of your data.
|
|
|
|
|
i have included account and problem persist.
|
|
|
|
|
When you added the username and password to your connection string, did you ALSO remove the Integrated Security option from it??
|
|
|
|
|
|
Can I execute an exe in a windows application ? My exact requirement is,
on the button click event I should run the exe in the same window where the button resides. Right now I am using process.start() to execute, but it is opening a new window.
Thank U all,
Kiran
|
|
|
|
|
There is a CP article on this. It's a real hack ,but you can do something. Odds are you're going to break your app tho, I would not do it.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|