473,799 Members | 3,212 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Take Pity on a procedural programmer Please

frmMIS.UserName .Text is defaulted to 'sa'
I change it to 'sa1' when logged in as admin.
I hit btnApply.
I want frmMISRoutine.U serName.Text to become 'sa1' immediatly.
I do not want to show the form immediately.
I hit btnRoutines and load frmMISRoutine screen.
I want to see frmMISRoutine.U serName.Text as 'sa1'
How the hell can I do it...my code is below:
I don't mind learning how to write classes/modules but shouldn't this be a
simple enough thing to do. I still think that it is not much use beeing able
to share objects between screens if you have to load that screen straight
away. It doesn't seem very dynamis, what if you wanted to update the value on
4 screens, would you have to show them all?

UserName.Text on both forms is defaulted to 'sa'

' Apply button to set Routines.UserNa me.Text from 'sa' to 'sa1'
Private Sub btnApply_Click( ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnApply.Click
Dim frmMISRoutine As New Routines
frmMISRoutine.U serName.Text = Me.UserName.Tex t

Me.ClientSize = New System.Drawing. Size(584, 435)
pnlProperties.V isible = False
btnProperties.E nabled = True
btnApply.Visibl e = False
btnCancel.Visib le = False
sbMIS.Text = "Use buttons to navigate the application (e.g.) [Properties
sets the database and log parameters]."
PollDirectory = txtPollDirector y.Text
End Sub

' Open Routines Form. the UserName.Text should be 'sa1'.
Private Sub btnRoutines_Cli ck(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnRoutines.Cli ck
Dim frmMISRoutine As New Routines
frmMISRoutine.S how()
Me.Close()
' When this loads Routines UserName is still sa aaarrrrgggghhhh hh!!!
End Sub

Nov 21 '05 #1
4 1025
marcmc wrote:
frmMIS.UserName .Text is defaulted to 'sa'
I change it to 'sa1' when logged in as admin.
I hit btnApply.
I want frmMISRoutine.U serName.Text to become 'sa1' immediatly.
I do not want to show the form immediately.
I hit btnRoutines and load frmMISRoutine screen.
I want to see frmMISRoutine.U serName.Text as 'sa1'
How the hell can I do it...my code is below:
I don't mind learning how to write classes/modules but shouldn't this be a
simple enough thing to do. I still think that it is not much use beeing able
to share objects between screens if you have to load that screen straight
away. It doesn't seem very dynamis, what if you wanted to update the value on
4 screens, would you have to show them all?

UserName.Text on both forms is defaulted to 'sa'

' Apply button to set Routines.UserNa me.Text from 'sa' to 'sa1'
Private Sub btnApply_Click( ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnApply.Click
Dim frmMISRoutine As New Routines
frmMISRoutine.U serName.Text = Me.UserName.Tex t

Me.ClientSize = New System.Drawing. Size(584, 435)
pnlProperties.V isible = False
btnProperties.E nabled = True
btnApply.Visibl e = False
btnCancel.Visib le = False
sbMIS.Text = "Use buttons to navigate the application (e.g.) [Properties
sets the database and log parameters]."
PollDirectory = txtPollDirector y.Text
End Sub

' Open Routines Form. the UserName.Text should be 'sa1'.
Private Sub btnRoutines_Cli ck(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnRoutines.Cli ck
Dim frmMISRoutine As New Routines
frmMISRoutine.S how()
Me.Close()
' When this loads Routines UserName is still sa aaarrrrgggghhhh hh!!!
End Sub


Well your problem seem to be you are dealing with two different Routines
objects. Everytime you do Dim frmMISRoutine As New Routines it makes a
new Routines object and set everything to the default. If you only want
to deal with one object, make a class level variable called
frmMISRoutine and then only use the "new" keyword once.

Public Class XYZ
dim frmMISRoutine as Routines

Private Sub btnApply_Click( ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnApply.Click
frmMISRoutine = New Routines
frmMISRoutine.U serName.Text = Me.UserName.Tex t

Me.ClientSize = New System.Drawing. Size(584, 435)
pnlProperties.V isible = False
btnProperties.E nabled = True
btnApply.Visibl e = False
btnCancel.Visib le = False
sbMIS.Text = "Use buttons to navigate the application (e.g.)
[Properties sets the database and log parameters]."
PollDirectory = txtPollDirector y.Text
End Sub

' Open Routines Form. the UserName.Text should be 'sa1'.
Private Sub btnRoutines_Cli ck(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnRoutines.Cli ck
'Dim frmMISRoutine As New Routines
'Now the frmMISRoutine already exists, don't make a new one
frmMISRoutine.S how()
Me.Close()
' When this loads Routines UserName is still sa aarrrrgggghhhhh h!!!
End Sub
Nov 21 '05 #2
I presume that btnApply and btnRoutines are both buttons on the main
form? In that case replace these lines:

Dim frmMISRoutin As New Routines
frmMISRoutine.U serName.Text = Me.UserName.Tex t

with:

Me.UserName.Tex t = "sa1"

Nov 21 '05 #3
yes Chris they are on the main form, thankyou and more aaaarrrrggghhhh ...

First example says that frmMISRoutine is not declared even though I declare
it within a class called dbProps
The second example does not even come close to ythe requirement i need. I
need to set the textBox on form2 when i hit the apply button on Form1, not
show form3 until button1 is pressed. That is all.

I have programmed in many languages and have never seen a rediculous means
of sharing global variables like this. Insane and Why?
"Chris" wrote:
marcmc wrote:
frmMIS.UserName .Text is defaulted to 'sa'
I change it to 'sa1' when logged in as admin.
I hit btnApply.
I want frmMISRoutine.U serName.Text to become 'sa1' immediatly.
I do not want to show the form immediately.
I hit btnRoutines and load frmMISRoutine screen.
I want to see frmMISRoutine.U serName.Text as 'sa1'
How the hell can I do it...my code is below:
I don't mind learning how to write classes/modules but shouldn't this be a
simple enough thing to do. I still think that it is not much use beeing able
to share objects between screens if you have to load that screen straight
away. It doesn't seem very dynamis, what if you wanted to update the value on
4 screens, would you have to show them all?

UserName.Text on both forms is defaulted to 'sa'

' Apply button to set Routines.UserNa me.Text from 'sa' to 'sa1'
Private Sub btnApply_Click( ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnApply.Click
Dim frmMISRoutine As New Routines
frmMISRoutine.U serName.Text = Me.UserName.Tex t

Me.ClientSize = New System.Drawing. Size(584, 435)
pnlProperties.V isible = False
btnProperties.E nabled = True
btnApply.Visibl e = False
btnCancel.Visib le = False
sbMIS.Text = "Use buttons to navigate the application (e.g.) [Properties
sets the database and log parameters]."
PollDirectory = txtPollDirector y.Text
End Sub

' Open Routines Form. the UserName.Text should be 'sa1'.
Private Sub btnRoutines_Cli ck(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnRoutines.Cli ck
Dim frmMISRoutine As New Routines
frmMISRoutine.S how()
Me.Close()
' When this loads Routines UserName is still sa aaarrrrgggghhhh hh!!!
End Sub


Well your problem seem to be you are dealing with two different Routines
objects. Everytime you do Dim frmMISRoutine As New Routines it makes a
new Routines object and set everything to the default. If you only want
to deal with one object, make a class level variable called
frmMISRoutine and then only use the "new" keyword once.

Public Class XYZ
dim frmMISRoutine as Routines

Private Sub btnApply_Click( ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnApply.Click
frmMISRoutine = New Routines
frmMISRoutine.U serName.Text = Me.UserName.Tex t

Me.ClientSize = New System.Drawing. Size(584, 435)
pnlProperties.V isible = False
btnProperties.E nabled = True
btnApply.Visibl e = False
btnCancel.Visib le = False
sbMIS.Text = "Use buttons to navigate the application (e.g.)
[Properties sets the database and log parameters]."
PollDirectory = txtPollDirector y.Text
End Sub

' Open Routines Form. the UserName.Text should be 'sa1'.
Private Sub btnRoutines_Cli ck(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnRoutines.Cli ck
'Dim frmMISRoutine As New Routines
'Now the frmMISRoutine already exists, don't make a new one
frmMISRoutine.S how()
Me.Close()
' When this loads Routines UserName is still sa aarrrrgggghhhhh h!!!
End Sub

Nov 21 '05 #4
Marc,

Place in the load event of your mainform this

dim frm as new frmMisRoutine
frm.mypassword = "whatever"
frm.showdialog
dim myresult as string = frm.mypassword
frm.dispose

In your frmMisRoutine you create

Friend mypassword as string

In the load event of that form you set
TheTextBoxYouWa nt.Text = mypassword

And before you close you do
mypassword = TheTextBooxYouW ant

There are easier methods however this is in my opinion well to understand
the behaviour.

You have to know that VBNet controls have no child controls direct however
VBNet controls (Form is one of those) have only control arrays. It is a
little bit confusing that so many VB6 people have written that the
controlarrays don't exist anymore in VBNet. The way the controlarray as it
was in VB6 does not exist anymore.

I hope that this gives some ideas

Cor
Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
275
by: pdcjlw1 | last post by:
I am attempting to learn how to program in VisualBasic.Net after many years as a Cobol programmer. I've done some simple things in VisualBasic.net and have a good understainding of SQL, but I still have trouble with the concept of Objects and how to use the code sharing features of VisualBasic. Can anyone suggest a method of training that works well with older Cobol programmers? Thanks.
3
3253
by: Christian McArdle | last post by:
REQUEST FOR DISCUSSION (RFD) unmoderated group comp.os.ms-windows.programmer.64bit This is a formal Request For Discussion (RFD) to create comp.os.ms-windows.programmer.64bit as an unmoderated world-wide Usenet newsgroup dedicated to the discussion of Microsoft Windows 64-bit programming. This is not a Call for Votes (CFV); you cannot vote at this time. Procedural details appear below. All followup discussion should be crossposted to...
4
4466
by: Mark Mikulec | last post by:
Hi there, I wonder if anyone can shed some light on a very frustrating problem. I'm running a debian linux 3.0 "woody" server, nothing special, with the latest version of postres that apt-get will allow me, which I *think* it;s 7.1 something, I don't know how to figure out the postgres version. Anywho - I'm trying to backup my databases, which I did at one point, but I have no idea what happened, could have been an upgrade. My Dbs...
2
1503
by: John Gabriele | last post by:
The way I've always "designed" procedural C programs has just been to: A. Think about what I need to do B. Draw a flowchart with pencil and paper C. Implement the flowchart in C from the top down D. Compartmentalize chunks of code that serve some specific purpose into functions, while filling in the framework left by the top- down approach. E. Refactor until I can call it pretty much done.
13
1612
by: parley | last post by:
After several years of programming WWW applications in ASP.NET (and several other frameworks) our division has come to what might seem a counterintiutive conclusion: Writing ASP.NET code in a "procedural" manner (without webcontrols and without utilizing OOP concepts in general) produces code that is remarkably faster and more scalable. In general a "bare ASP.NET" application outruns it's OOPy counterpart by factors of 2 to 10. ...
16
4400
by: Manuel | last post by:
Please, excuse me for starting this discussion. I'm not a troll, and I love the OOP architecture. However I'm a C++ newbie, and sometimes it's hard for me to fully understand the improvement of OOP. Please excuse my poor english too. I hope it's sufficient to explain my question. Generally OOP is better than procedural, but in a case I'm working on, I'm not sure. This is an example of my doubts. I'm writing a simple GUI openGL based.
4
2776
by: Mohitz | last post by:
Any pointers as to how one should go about porting procedural type code into object oriented code?? --- Mohit
3
9630
by: KiranJyothi | last post by:
Hi All, I am new to the software languages and wanted to learn C++. It seems that C++ is neither(completely) an object oriented programming nor(completely) a proceduarl programming. So, I was wonderinmg what is the diffrence between object oriented and procedural programming. Can anyone of you, please, let me know the difference as soon as possible. Thanks and regrads, KiranJyothi
2
5739
by: san1014 | last post by:
Hi I have few questions. Pleae give me the answers. 1) In postgreSQL, how to declare and call the cursors in a stored procedural function? Ex: I want to display all the columns in a table in one cursor and also how to see the output. 2) tell me , the analytic functions in oracle connect by prior, sys_connect_by_path are existed in postgreSQL? 3)how to call the stored procedural function which was written in postgres in java?
0
2803
by: FLANDERS | last post by:
Hi all, Is it possible to declare a SQL type of result set or similar? I want to do use the IN predicate like you can in a non-procedural SQL like this: UPDATE TABLE1 SET COL1 = 123 WHERE COL2 IN (SELECT COL3 FROM TABLE2) I want to do this in procedural SQL, but I only want to use one cursor. So to do this I have declared a cursor for selecting COL2 from TABLE1 into a variable v_COL2 and am using a loop to iterate over the values....
0
9541
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10485
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10252
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10027
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9073
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4141
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.