473,322 Members | 1,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

how to pass a variable to another class?

hi mate! i'm showing just a part of my source code. i need to pass the 'GetSeconds' variable to my SqlDB. can somebody show me how to pass it? what should i need to add in? thanks for the kindly help..
Expand|Select|Wrap|Line Numbers
  1. namespace test
  2. {
  3.     public partial class test : Form
  4.     {
  5.         private long GetSeconds(int hour, int minutes)
  6.         {
  7.             if ((hour != 0) && (minutes!=0))            
  8.                 return ((hour*3600) + (minutes * 60));            
  9.             else if (hour != 0)            
  10.                 return (hour * 60 * 60);
  11.             else
  12.                 return (minutes *  60);
  13.         }
  14.     } 
  15. }
  16.  
  17.  
  18. namespace test
  19. {
  20.     class SqlDB
  21.     {
  22.         private void RecoverSchedule()
  23.         {
  24.             switch (Convert.ToInt32(myReader.GetValue(myReader.GetOrdinal("Interval_Type"))))            
  25.            {
  26.                 case 1:
  27.                           Interval = GetSeconds(0, Convert.ToInt32(myReader.GetValue(myReader.GetOrdinal("Interval_Time"))));                            
  28.                           break;
  29.           }
  30.     }
  31. }
Please enclose any code within the proper code tags. See the Posting Guidelines on how to do that.

moderator
Mar 6 '08 #1
3 1123
ronverdonk
4,258 Expert 4TB
What has this thread got to do with MySQL, that is the forum this is in!

moderator
Mar 6 '08 #2
Oops! sorry about that.....
Mar 7 '08 #3
ronverdonk
4,258 Expert 4TB
So, get out of here!.

moderator
Mar 7 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Doug Jordan | last post by:
I am fairly new to Python. This should be an easy answer but I cannot get this to work. The code is listed below. I know how to do this in C, Fortran, and VB but it doesn't seem to work the same...
11
by: Vanessa | last post by:
Hi, I would like to know whether there's any way for me to pass an object by reference to another form? Regards Vanessa
4
by: mangi03 | last post by:
Hi, I came acrosss g++ compile errors whenever I make a function call by reference and found out from the test program that compiler is treating the function argument differently when another...
4
by: z_learning_tester | last post by:
I'm reading the MS press C# book and there seems to be a contradiction. Please tell me which one is correct, 1 or 2. Thanks! Jeff 1. First it gives the code below saying that it prints 0 then...
8
by: darrel | last post by:
I'm still trying to fully understand how best to pass variables between pages/usercontrols/each other. On a current site I've done, I've had one userControl do the logic and set the variable,...
14
by: Derek Basch | last post by:
This one has always bugged me. Is it better to just slap a "self" in front of any variable that will be used by more than one class method or should I pass around variable between the methods? ...
1
by: mgoold2002 | last post by:
Here is the offending excerpt from my code. I just began trying to port some vb code I'd written into my first .NET app. Public Class bannergenerator 'THIS IS AN ORDINARY WINDOWS FORM Inherits...
9
by: mps | last post by:
I want to define a class that has a generic parameter that is itself a generic class. For example, if I have a generic IQueue<Tinterface, and class A wants to make use of a generic class that...
12
by: Bryan Parkoff | last post by:
I write my large project in C++ source code. My C++ source code contains approximate four thousand small functions. Most of them are inline. I define variables and functions in the global scope....
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.