cgeier 187 Junior Poster

Also, if only one radio button should be selected at a time group them together by placing them on a Panel or on a GroupBox.

cgeier 187 Junior Poster

Use a panel. Put a Panel (or GroupBox) on your form. Put the radio buttons on the panel (or GroupBox). Then use the "CheckChanged" (radio button) event:

AndRadioButton_CheckedChanged

        private void AndRadioButton_CheckedChanged(object sender, EventArgs e)
        {
            if (AndRadioButton.Checked)
            {
                Console.WriteLine("AndRadioButton selected.");
            }//if
            else
            {
                Console.WriteLine("AndRadioButton NOT selected.");
            }//else

        }

OrRadioButtion_CheckedChanged

        private void OrRadioButton_CheckedChanged(object sender, EventArgs e)
        {
            if (OrRadioButton.Checked)
            {
                Console.WriteLine("OrRadioButton selected.");
            }//if
            else
            {
                Console.WriteLine("OrRadioButton NOT selected.");
            }//else

        }

Since the radio buttons are part of a group (by using a Panel or GroupBox), when one is checked the other will be unchecked. So we only need to worry about in the beginning if both are unchecked. To deal with that situation, use an event for each radio button and remove the "else" statements that I put in the code above.

cgeier 187 Junior Poster

In line 22 you stated that if any of the 4 checkboxes are checked then ....(line 30): correct = true.

In line 36, if correct is true, it is a match.

cgeier 187 Junior Poster

On your combobox, use either event "SelectedValueChanged" or "SelectedIndexChanged".

SelectedValueChanged

        private void EMP_CB_SelectedValueChanged(object sender, EventArgs e)
        {
            Console.WriteLine("ValueMember A: " + EMP_CB.ValueMember.ToString() + " DisplayMember A: " + EMP_CB.DisplayMember.ToString());

            //---------------------------
            //Get data for selected item
            //---------------------------
            DataRow selectedDataRow = ((DataRowView)EMP_CB.SelectedItem).Row;
            int empId = Convert.ToInt32(selectedDataRow["EMPCODE"]);
            string empName = selectedDataRow["EMPNAME"].ToString();

            Console.WriteLine("empId A: " + empId + " empName A: " + empName);
            Console.WriteLine();
        }

SelectedIndexChanged

        private void EMP_CB_SelectedIndexChanged(object sender, EventArgs e)
        {
            Console.WriteLine("ValueMember B: " + EMP_CB.ValueMember.ToString() + " DisplayMember B: " + EMP_CB.DisplayMember.ToString());

            //---------------------------
            //Get data for selected item
            //---------------------------
            DataRow selectedDataRow = ((DataRowView)EMP_CB.SelectedItem).Row;
            int empId = Convert.ToInt32(selectedDataRow["EMPCODE"]);
            string empName = selectedDataRow["EMPNAME"].ToString();

            Console.WriteLine("empId B: " + empId + " empName B: " + empName);
            Console.WriteLine();
        }

The code is the same inside both.

Taken from: Here and Here

GagaCode commented: that One Answered it +0
cgeier 187 Junior Poster

In line #2 try changing the space between "OLEDB" and "12.0" to a "." (dot or period). So the line reads: Provider = Microsoft.ACE.OLEDB.12.0; instead of Provider = Microsoft.ACE.OLEB 12.0;

If you still have problems, ensure you can make a connection in VS.

  • Select "View" (from menu)
  • Select "Server Explorer"
  • Right-click "Data Connections"
  • Select "Add Connection"
  • Browse for you Database file name
  • Click "Test Connection"
cgeier 187 Junior Poster

Need to use exception handling.

try
{
   //run your code here...

}
catch (FileNotFoundException e) {
    System.err.println("FileNotFoundException: " + e.getMessage());

    //do whatever you want to do when 
    //this exception happens
}//

Click Here for documentation.

cgeier 187 Junior Poster

Try something like the following:

private static int Sum()
        {
            int subTotal = 0;
            string inputVal = string.Empty;

            //read value until an empty line is encountered
            while(!string.IsNullOrEmpty(inputVal=Console.ReadLine()))
            {
                int result = 0;

                //convert string to int 
                //converted string will be in result
                Int32.TryParse(inputVal, out result);

                //add
                subTotal += result;
            }//while
            return subTotal;
        }
cgeier 187 Junior Poster

Here's a program I wrote to remove the line numbers from code posted on this site. It will save you some time copying the code to run my examples.

To use "Form1.cs" you need a form that contains:

  • TextBox named: userMatchPatternTextBox
  • Button named: resetBtn
  • Button named: runBtn
  • Button named: clearAllBtn
  • RichTextBox named: inputRichTextBox
  • RichTextBox named: outputRichTextBox

*Note: Need to add using System.Text.RegularExpressions;

Form1.cs

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        //override ctl-v
        //so we can process the data--ensuring unicode data is properly
        //converted

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData) 
        {
            if(keyData == (Keys.Control | Keys.V))
            {
                 //your implementation
                inputRichTextBox.Text = GetClipboardData();

                 return true;
            } 
            else 
            {
                return base.ProcessCmdKey(ref msg, keyData);
            }
        }//ProcessCmdKey

        private void runBtn_Click(object sender, EventArgs e)
        {
            String userDefinedMatchPattern = userMatchPatternTextBox.Text.ToString();

            string userData = inputRichTextBox.Text.ToString();

            string[] userDataArray = userData.Split(new string[] { "\r\n","\n","\r"}, StringSplitOptions.None);


            Regex rgx = new Regex(userDefinedMatchPattern);

            string output = string.Empty;
            foreach (string lineData in userDataArray)
            {
                string result = rgx.Replace(lineData, string.Empty);

                output += result + System.Environment.NewLine;
            }//foreach

            outputRichTextBox.Text = output;
        }

        private void resetBtn_Click(object sender, EventArgs e)
        {
            userMatchPatternTextBox.Text = "^\\s?\\d+\\.";
        }

        private void clearAllBtn_Click(object sender, EventArgs e)
        {
            outputRichTextBox.Text = string.Empty;
            inputRichTextBox.Text = string.Empty;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            userMatchPatternTextBox.Text = "^\\s?\\d+\\.";
        }

        private string GetClipboardData()
        {
            string cbText = string.Empty;
            bool cbContainsUnicodeText = false;
            bool cbContainsText = false;

            IDataObject cbDataObject = Clipboard.GetDataObject();

            string[] cbObjectTypes = cbDataObject.GetFormats();

            foreach (string cbObject in cbObjectTypes)
            {
                //Console.WriteLine("obj: " + cbObject);


                if (string.Compare(cbObject, "UnicodeText") == 0) …
cgeier 187 Junior Poster

Here is an updated version of "SearchMemberFrm.cs". It uses a DataGridView instead of ListView. I think that DataGridView is a better option.

"SearchMember.cs" requires the following:

  • Button named: searchBtn
  • DataGridView named: dataGridView1

*Note: Just add a DataGridView. Do NOT configure any columns or add any events. The configuration and events are in the code.

The database retrieval part of the code that is commented out is untested.

SearchMemberFrm.cs

//  download and install mySQL connector
//  http://dev.mysql.com/downloads/connector/net/
//
//  for .NET 4.0
//  Create reference: Select "Project" => Reference => Browse
//  => C:\Program Files\MySQL\MySQL Connector Net 6.8.3\
//        Assemblies\v4.0\MySQL.Data.dll

//  add "using MySql.Data.MySqlClient;" above
//
//  may also need to create reference to: MySQL.web.dll
//  
// add the below "using" statement to your searchMemberFrm class
// using MySql.Data.MySqlClient;


    public partial class SearchMemberFrm : Form
    {
        //event interested parties can register with 
        //to know when value is updated.
        public event ValueUpdatedEventHandler ValueUpdated;

        private MemberInfo member = new MemberInfo();

        private DataTable dt;


        public SearchMemberFrm()
        {
            InitializeComponent();
        }//initialize



        private void SearchMemberFrm_Load(object sender, EventArgs e)
        {

            //set minimum size for window
            this.MinimumSize = new System.Drawing.Size(350, 250);

            //http://social.msdn.microsoft.com/Forums/windows/en-US/a44622c0-74e1-463b-97b9-27b87513747e/windows-forms-data-controls-and-databinding-faq?forum=winformsdatacontrols#faq13

            //add listener for CellDoubleClick
            this.dataGridView1.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellDoubleClick);

            //change anchor property so dataGridView1 resizes with the window
            this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));

            //hide first column that contains '*'
            dataGridView1.RowHeadersVisible = false;

            //select whole row when cell is clicked
            dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;

            //eliminate blank first row
            //http://msdn.microsoft.com/en-us/library/ms171605(v=vs.90).aspx
            // Configure the DataGridView so that users can manually …
cgeier 187 Junior Poster

Ok. I've made an example specific to your situation. I didn't do the database data retrieval however. I'll let you work on that part. I've made a note of where you should do the database retrieval (in SearchMemberFrm.cs). To run my example you will need the following.

On "Form1.cs":

  • Textbox named: idNumberTextBox
  • Textbox named: firstNameTextBox
  • Textbox named: miTextBox
  • TextBox named: lastNameTextBox
  • Button named: searchBtn

On "SearchFrm.cs":

  • Button named: searchBtn
  • ListView named: listView1

*Note: listView1 needs to contain (at least) 4 columns.

MemberInfo.cs

    public class MemberInfo
    {
        private string _idNumber = string.Empty;
        private string _firstName = string.Empty;
        private string _mi = string.Empty;
        private string _lastName = string.Empty;
        private string _mobileNumber = string.Empty;
        private string _email = string.Empty;
        private string _researchDirectorHead = string.Empty;
        private string _universityPresident = string.Empty;
        private string _mailingAddress = string.Empty;

        public string idNumber
        {
            get
            {
                return this._idNumber;
            } //get

            set
            {
                this._idNumber = value;
            } //set
        } //idNumber

        public string firstName
        {
            get
            {
                return this._firstName;
            } //get

            set
            {
                this._firstName = value;
            } //set
        } //firstName

        public string mi
        {
            get
            {
                return this._mi;
            } //get

            set
            {
                this._mi = value;
            } //set
        } //mi

        public string lastName
        {
            get
            {
                return this._lastName;
            } //get

            set
            {
                this._lastName = value;
            } //set
        } //lastName

        public string mobileNumber
        {
            get
            {
                return this._mobileNumber;
            } //get

            set
            {
                this._mobileNumber = value;
            } //set
        } //mobileNumber

        public string email
        {
            get
            {
                return this._email;
            } //get

            set
            {
                this._email = value;
            } //set
        } //email

        public …
cgeier 187 Junior Poster

I'm not very familiar with using tables in java. You might check this out: Click Here

Also this: Click Here

cgeier 187 Junior Poster

You seem to be using NetBeans, so add your button. Then

  • Right-click on your button, select "Events"
  • Select "Action"
  • Select "actionPerformed"

add your code to perform when the button is pressed here.

Here is what NetBeans does:

private javax.swing.JButton jButton1;

//set button text
jButton1.setText("jButton1");

//add event listener
jButton1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
});

//event handler - do this when jButton1 button is pressed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        // TODO add your handling code here:


}//jButton1ActionPerformed


private javax.swing.JButton jButton2;
jButton2.setText("jButton2");

//add event listener
jButton2.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
});


//event handler - do this when jButton2 button is pressed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                         
      // TODO add your handling code here:

}//jButton2ActionPerformed

Here is another way to do it:

public class GUI extends JFrame implements ActionListener{

    private javax.swing.JButton jButton1;

    jButton1 = new JButton("jButton1");

    //add listener
    jButton1.addActionListener(this);


    private javax.swing.JButton jButton2;

    jButton2 = new JButton("jButton2");

    //add listener
    jButton2.addActionListener(this);


    //event handler -- this is called when any button is pressed
    public void actionPerformed(ActionEvent event) {

        //determine which button was pressed
        if (event.getSource() == jButton1) {
            //do this when jButton1 button is pressed

            // TODO add your handling code here:

        }//if 
        else if (event.getSource() == jButton2) {
            //do this when jButton2 button is pressed

            // TODO add your handling code here:

        }//else if
    }//actionPerformed

}//class

Click Here to see documentation.

cgeier 187 Junior Poster

Are you using NetBeans or Eclipse? If so, you may want to check out some tutorials on how to use those programs. Basically, you want to use a JFrame as you have done. Put some buttons (and maybe textboxes) on it. And do something when the buttons are pressed. You have to listen for events (button presses) and take action based on which button was pressed.

cgeier 187 Junior Poster

Code blocks. What I meant by that is to click "</> Code", paste your code for your first class. Click "Insert Code Snippit". Then repeat this for each class. Rather than clicking it once and posting it all together. What will this do? Make it so people are more likely to read your code.

cgeier 187 Junior Poster

Reading URL: Click Here

Reading and writing to URL: Click Here

Programmatically click a web page button Click Here

Selenium video tutorials: Click Here

cgeier 187 Junior Poster

Please search for "What is a graphical user interface" and read more about the purpose of a gui. Basically you are going to eliminate "TestClass" and replace it with your "GUI". Click Here to see an example of what someone else who had this assignment did.

To enter data in your table, you are going to need to set CellSelectionEnabled(true); or click on the checkbox in NetBeans. However, from what you wrote, it looks like your instructor wants you to display one record at a time, not multiple records.

I think that it makes it easier to follow the code you posted if you separate your code blocks by class when you post them.

Class 1

//Class 1 code

Class 2

//Class 2 code

Rather than posting all of your code in one code block.

//Class 1

//Class 1 code

//Class 2
//Class 2 code
cgeier 187 Junior Poster

This would be better in a class. Then use an array of your class type.

cgeier 187 Junior Poster

Check your variable names. You declare char star = '*' and then you try to declare star as an int in your for loop. int star = 0;

cgeier 187 Junior Poster

Try writing the problem out in steps first. You can use pseudo-code (a combination of written language and computer language).

Prompt for number of assignments - "numAssignments"

for each assignment {
    Prompt for score - "enteredScore"

    totalScore = totalScore + enteredScore
}

averageScore = ....

Now convert that into code.
How do you write a proper for loop in C++? Convert the pseudo-code to a C++ for loop.

example data:
Score 1: 92
Score 2: 85
Score 3: 95

Using what I have above.

numAssignments = 3

How many assignments do you need to prompt for scores?
How can you write that in a for loop? Write it out on paper plugging in the values.

cgeier 187 Junior Poster

The value is stored in the registry under the following key:

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Start Page

and additional "start" urls (tabs) are in:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Secondary Start Pages

Click Here for a powershell script.

cgeier 187 Junior Poster

In line 14 change int days; to int days = 0; or whatever value you want to initialize it to. You really should do some input validation, then your switch statement becomes more predictable, and there won't be the possibility of invalid values. Right now I can enter values such as 'a', 'b', etc..

Questions: What do you want to do if user enters 1 or more (non-numeric) characters? What do you want to do if user enters a digit > 1 or < 1 for month? What about year?

cgeier 187 Junior Poster

I think that he would like you to place all of your variable declarations in one place rather than throughout your program.

public static void main(String[] args) {

    //Declarations
    int first = 0;  //first integer
    int second = 0; //second integer
    double result = 0; 
    String option;


    Scanner in = new Scanner(System.in);

    do{
        // Welcomes user
        System.out.println("****Welcome to calculator*******");  

        first = in.nextInt();

        ....


    } while(option.equalsIgnoreCase("Y"));

    in.close();
}
cgeier 187 Junior Poster

You may also want to read about early bindind vs late binding Click Here.

"If you will be using a component that you do not redistribute with your setup package, and cannot be assured of the exact version you will be communicating with at run-time, you should pay special attention to early bind to an interface that is compatible with all versions of the component, or (in some cases) use late binding to call a method that may exist in a particular version and fail gracefully if that method is not present in the version installed on the client system."

"Microsoft Office applications provide a good example of such COM servers. Office applications will typically expand their interfaces to add new functionality or correct previous shortcomings between versions. If you need to automate an Office application, it is recommended that you early bind to the earliest version of the product that you expect could be installed on your client's system. For example, if you need to be able to automate Excel 95, Excel 97, Excel 2000, and Excel 2002, you should use the type library for Excel 95 (XL5en32.olb) to maintain compatibility with all three versions."

Click Here for another resource.

cgeier 187 Junior Poster

This code should work.

Private Sub runBtn_Click()

    'add reference to Microsoft.Excel; Project => Reference =>
    'Microsoft Excel ... Object Library

    Dim excelApp As Excel.Application
    Dim excelWB As Excel.workbook
    Dim excelWS As Excel.Worksheet

    'name of desired worksheet
    Dim wsName As String
    wsName = "blad1"

    'add reference to Microsoft Scripting Runtime; Project => Reference =>
    'Microsoft Scripting Runtime

    Dim fso As New FileSystemObject


    Dim fn As String
    Dim myCurrentDir As String

    Dim retVal

    'check to see if backslash already exists
    'if not, add it
    If Right$(App.Path, 1) = "\" Then
        myCurrentDir = App.Path
    Else
        myCurrentDir = App.Path & "\"
    End If

    fn = myCurrentDir & "kundreg\blkfaktura2.xls" 'use this one

    If (fso.FileExists(fn) = False) Then
       retVal = MsgBox("File: '" & fn & "' does not exist.", vbSystemModal + vbExclamation, "Error")
       Return
    Else
        retVal = MsgBox("File: '" & fn & "' found. Opening...", vbSystemModal + vbInformation, "File Found")

        Set excelApp = CreateObject("Excel.Application")
        excelApp.Visible = True 'make excel visible

        Set excelWB = excelApp.Workbooks.Open(fn) 'open the excel file

        Set excelWS = FindWorkSheet(excelWB, wsName) 'see if worksheet exists

        'if worksheet doesn't exist, clean up and exit
        If (excelWS Is Nothing) Then
            retVal = MsgBox("Worksheet: '" & wsName & "' does not exist in '" & fn & "'. Exiting.", vbSystemModal + vbExclamation, "Error")
            GoTo CleanUp
        End If


        'from http://support.microsoft.com/kb/247412
        'set cell F9 to TestF9

        excelWS.Range("F9").Value = "TestF9"
        excelWS.Range("G9").Value = "TestG9"


        'http://vbcity.com/forums/t/145906.aspx
        'setting DisplayAlerts = false prevents prompting
        'for overwriting the file
        excelApp.DisplayAlerts = False 'turn off error messages
        excelWB.SaveAs (fn)
        excelApp.DisplayAlerts = …
cgeier 187 Junior Poster

It works for me. Please post the code that you are using. Perhaps you omitted something while copying my code.

Did you add the references?

cgeier 187 Junior Poster

What version of Excel are you using?

cgeier 187 Junior Poster

To auto-populate the BCC field in Outlook, we will create an e-mail template, and create a button that uses a macro to open the e-mail template.

Enable Developer options
  1. Open Outlook
  2. Select "File"
  3. Select "Options"
  4. Click "Customize Ribbon"
  5. In the right-pane, select the "Developer" checkbox
  6. Click "OK"
Create a new e-mail template:
  1. Click "Home" tab
  2. Click "New E-mail"
  3. Customize your e-mail as desired with recipients ("To", "BCC", etc)
  4. Select "File"
  5. Select "Save As"
  6. Change "Save as type" to "Outlook Template (.oft)"
  7. Change "File name" to your desired filename.
  8. Click "Save" (Default will save to %AppData%MicrosoftTemplates)
Create Macro:
  1. On the "Developer" tab, select "Macros",
  2. Select "Macros"
  3. For "Macro Name:", erase any contents and type what you want to call your macro (ex: BccEmail)
  4. Click "Create"

You will see the following:

Sub BccEmail()

End Sub

Copy the code below:

Dim userPath As String
Dim myPath As String

'used to get environment variables found by typing "set" in a cmd window
userPath = Environ("AppData")

myPath = userPath & "MicrosoftTemplatesdefault.oft"
Set msg = Application.CreateItemFromTemplate(myPath)
msg.Display

It should now look like:

Sub BccEmail()
  Dim userPath As String
  Dim myPath As String

  'used to get environment variables found by typing "set" in a cmd window
  userPath = Environ("AppData")

  myPath = userPath & "MicrosoftTemplatesdefault.oft"
  Set msg = Application.CreateItemFromTemplate(myPath)
  msg.Display
End Sub
  1. Click "File"
  2. Select "Save VbaProject.OTM"
  3. Select "Close and Return to Microsoft Outlook"
Create either a Quick Access button or a toolbar group / menu item for …
cgeier 187 Junior Poster

It is better practice to store your data in "My Documents" or "AppData"--in my opinion.

cgeier 187 Junior Poster

So it's working now? Here is some code that can be used for testing purposes:

Create a form called "Form1" and add a button. Rename the button to "runBtn".

Form1.frm

Private Sub runBtn_Click()


    Dim userVar As Long


    'add reference to Microsoft.Excel; 
    'Project => Reference =>
    'Microsoft Excel ... Object Library

    Dim objX1 As New Excel.Application
    Dim objWb As Excel.Workbook

    'add reference to Microsoft Scripting Runtime;
    'Project => Reference =>
    'Microsoft Scripting Runtime

    Dim fso As New FileSystemObject


    Dim fn1, fn2, fn3 As String
    Dim myCurrentDir As String

    Dim retVal

    Dim xlTmp As Excel.Application
    Set xlTmp = Excel.Application


    MsgBox ("UserProfile Folder: " & fGetSpecialFolder(CSIDL_PROFILE))
    MsgBox ("My Documents: " & fGetSpecialFolder(CSIDL_PERSONAL))

    MsgBox ("All User Documents: " & fGetSpecialFolder(CSIDL_COMMON_DOCUMENTS))

    ' "\" may or may not exist at end of App.Path
    If Right$(App.Path, 1) = "\" Then
        myCurrentDir = App.Path
    Else
        myCurrentDir = App.Path & "\"
    End If

    fn1 = "C:\kundreg\bokfaktura2.xls"
    fn2 = App.Path & "\kundreg\blkfaktura2.xls"

    fn3 = myCurrentDir & "kundreg\blkfaktura2.xls" 'use this one

    'check to see if file exists
    If (fso.FileExists(fn1) = False) Then
       retVal = MsgBox("fn1 File: '" & fn1 & "' does not exist. Exiting.", vbExclamation, "Error")
       'Return
    Else
        xlTmp.Workbooks.Open (fn1)
    End If

    If (fso.FileExists(fn2) = False) Then
       retVal = MsgBox("fn2 File: '" & fn2 & "' does not exist.", vbExclamation, "Error")
       'Return
    Else
        xlTmp.Workbooks.Open (fn2)
    End If

    If (fso.FileExists(fn3) = False) Then
       retVal = MsgBox("fn3 File: '" & fn3 & "' does not exist.", vbExclamation, "Error")
       'Return
    Else
        xlTmp.Workbooks.Open (fn3)
    End If

End Sub

Here is some code …

cgeier 187 Junior Poster

What operating system (XP, vista, Win 7)?

cgeier 187 Junior Poster

As far as child-parent form communication. You could use events, which I think may be your best option.

In my example, you will have 3 classes: "parentFrm", "childFrm", and "ValueUpdatedEventArgs".

ValueUpdatedEventArgs.cs

//ValueUpdatedEventArgs.cs
using System;
using System.Collection.Generic;
using System.Text;

namespace myNamespace1;
{
     public delegate void ValueUpdatedEventHandler(object sender, ValueUpdatedEventArgs e);

     public class ValueUpdatedEventArgs : System.EventArgs
     {
        private string _myData1;

        //---------------------------------------
        //this is just a normal class constructor
        //---------------------------------------

        public ValueUpdatedEventArgs(string newValue)
        {
             this._myData1 = newValue;
        }//constructor

        public string MyData1
        {
            get
            {
                return this._myData1;
            }//get
        }//method

     }//class
}//namespace

In the below code, for your purposes, change myTextBox_TextChanged(object sender, EventArgs e) to listView1_MouseDoubleClick(object sender, MouseEventArgs e)

childFrm.cs

//childFrm.cs --child form
using System;
using System.Collection.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace myNamespace1;
{

     public partial classchildFrm : Form
     {
        //--------------------------------------------
        // event interested parties can register with 
        // to know when value is updated.
        //--------------------------------------------

        public event ValueUpdatedEventHandler ValueUpdated;



        private void myTextBox_TextChanged(object sender, EventArgs e)
        {



            // the following lines are the ones to be 
            // added within the event
            // you want to use to update the value. In 
            // this case, we use the textbox
            // TextChanged event and set the value to 
            // 'myTextBox.Text.ToString()'
            // the data type of this variable needs to 
            // be the same data type
            // that is defined in 
            // 'ValueUpdatedEventArgs.cs'

            string myValue = "some new value";
            ValueUpdatedEventArgs valueArgs = new ValueUpdatedEventArgs(myValue);
            ValueUpdated(this, valueArgs);



        }//myTextBox_TextChanged

     }//class
}//namespace

parentFrm.cs

using System;
using System.Collection.Generic;
using System.ComponentModel;
using System.Data; …
cgeier 187 Junior Poster

If you have a large dataset you may want to read about virtual mode. Here is a post that discusses it

cgeier 187 Junior Poster

app.path shouldn't have quotes around it. Try
xlTmp.Workbooks.open (App.Path & "\kundreg\bokfaktura2.xls"). If that doesn't work, then try putting App.Path & "\kundreg\bokfaktura2.xls" in a string variable first, and then passing the string variable to the open command
xlTmp.Workbooks.open (myStringVariable)

cgeier 187 Junior Poster

What is your question?

cgeier 187 Junior Poster

Where is the output? Were you required to make all of those items menu items? It doesn't seem very user-friendly.

cgeier 187 Junior Poster

Read more about classpath. classpath Documentation

From the documentation:

...Multiple path entries are separated by semi-colons....

The default class path is the current directory. Setting the CLASSPATH variable or using the -classpath command-line option overrides that default, so if you want to include the current directory in the search path, you must include "." in the new settings.

Classpath entries that are neither directories nor archives (.zip or .jar files) nor '' are ignored.

Also, I think that in your first post, the colon in -classpath should be a semi-colon

cgeier 187 Junior Poster

I know what you're trying to do. But I want to see how you are doing it, because obviously what you are doing isn't working for you. Without the code I can't help any further. Also include the batch (.bat) file. What C compiler are you using? Also a screen shot of the error may be helpful.

cgeier 187 Junior Poster

I found the following article, which may be similar to your issue. Click Here

cgeier 187 Junior Poster

What version of iTunes?

cgeier 187 Junior Poster

Can you post your code? Also, what program are you trying to use to play the mp3? Check the Windows default: Control Panel (View by: Large icons) => Default programs => Associate a file type or protocol with a program. Look for "mp3." What is the current default?

cgeier 187 Junior Poster

If using '\', you may need to escape it. So use system("c:\\xyz.bat"); instead of system("c:\xyz.bat");

cgeier 187 Junior Poster

I discovered another solution that lets you avoid 8.3 filenames. Use double-quotes. But you need to escape them with a '\'.

#include <cstdlib>

int returnVal = 0;

//need to put quotes if dir or filename contains spaces
//need to escape quotes
returnVal = system("\"c:/batch scripts/startmp3.bat\"");

if (returnVal != 0)
{
    printf("An error occurred while running the command.  (%i)\n",returnVal);
}//if
else
{
    printf("Command executed successfully.\n",returnVal);
}//else

return returnVal;

Here is another resource that may be of use:
How to spawn console processes with redirected standard handles

vibhu mishra commented: its not showing any illegal command and system() returing 0, but the problem is that my mp3 file is not playing..... on cmd same bath file work good and play mp3 +0
cgeier 187 Junior Poster

The following works for me:

#include <cstdlib>

//use 8.3 filename and directory name format
//my file is in "c:\batch scripts\startmp3.bat"

//To get the 8.3 directory name:
//in cmd window run > dir "c:\" /x | find /i "batch scripts"


system("c:\\batchs~1\\startmp3.bat"); //make sure to escape '\'

//should also be able to use:
//system("c:/batchs~1/startmp3.bat");

See How Windows Generates 8.3 File Name from Long File Names

The important thing is to use 8.3 (DOS) filenames.

cgeier 187 Junior Poster

I don't really know anything about OpenCalais, but here's something I found doing a search:

Security

OpenCalais supports SSL security of traffic to and from OpenCalais.
 GoDaddy is the authority for SSL certification. Simply use https:// instead of http://.

OpenCalais Security Documentation

cgeier 187 Junior Poster

You might try the following to install the standard bluetooth COM port driver.

1. Control Panel

2. Devices and Printers (If "View by" is large icons or small icons). If "View By" is Category, then under Hardware and Sound, click "View devices and printers".

3. If you see your phone device, right-click on your phone device (ex: LG 750), and select Properties. Otherwise, on your phone go to settings, bluetooth, and check the checkbox next to "Only visible to paired devices". Then on your computer, click on "Add a device". Your phone should show up. Select it, and click "Next." Enter the pin number shown, on your phone. Click "Close" (on computer window).

4. In the Bluetooth device window, right-click the phone icon and select 'Properties'

5. Click 'Hardware' tab 

6. Click 'Properties'button

7. Click 'Change settings' button (If prompted by "User Account Control", Do you want to allow the following program...." click "Yes")

8. Click 'Update driver' button

9. Click "Browse my computer for driver software"

10. Click "Let me pick from a list of device drivers on my computer"

11. Click 'Next'

12. Scroll down until you see 'Ports (COM & LPT)'. Select 'Ports (COM & LPT)'.

13. Click 'Next'

14. For Manufacturer, select 'Microsoft'. Under Model, select 'Standard Serial over Bluetooth link'.

15. Click 'Next'

16. You will see 'Update Driver Warning...Installing this device driver is not recommended...'. Click 'Yes'

17. Click 'Close' 

18. Click 'Close'

19. Click 'OK'
cgeier 187 Junior Poster

My C++ is a bit rusty, but I think that it may be because you are comparing a character array to a character. Which means that it will point to the first position in the array (I think). Line 4 should probably be

while(buffer[a] != '\0')
cgeier 187 Junior Poster
cgeier 187 Junior Poster

Account

It looks like you forgot to initialize 'id' and 'balance' to 0. Line 5 and line 8.

cgeier 187 Junior Poster

TestAccount class with main method.

public class TestAccount {

    public static void main(String[] args) {
    // add your code here


    }//main

}//TestAccount
cgeier 187 Junior Poster

Because it's not a TimeSpan. Use DateTime.Now.TimeOfDay. That is if ts1 is of type TimeSpan.