473,324 Members | 1,856 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,324 software developers and data experts.

how to check unchek checkboxes using xml

i have an xml file, i have to enable or disable checkboxes based on these valuse


Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <ModulesAvalable>
  3.  
  4.     <Module name="calculator" hasdatabase="False" enabled="True"></Module>
  5.     <Module name="employeemanager" hasdatabase="True"  enabled="False"></Module>
  6.     <Module name="Central Office" hasdatabase="False" enabled="True"></Module>
  7.     <Module name="emp/emp Manager" hasdatabase="True" enabled="True"></Module>
  8.  
  9. </ModulesAvalable>
so how to do this
Apr 6 '06 #1
1 5832
<?xml version="1.0" encoding="utf-8" ?>
<ModulesAvailable>
<Module>
<NAME>FRE</NAME>
<HASDATABASE>FALSE</HASDATABASE>
<ENABLED>FALSE</ENABLED>
</Module>
<Module>
<NAME>CENTRALOFFICE</NAME>
<HASDATABASE>FALSE</HASDATABASE>
<ENABLED>FALSE</ENABLED>
</Module>


<Module>
<NAME>POS</NAME>
<HASDATABASE>TRUE</HASDATABASE>
<ENABLED>TRUE</ENABLED>
</Module>

<Module>
<NAME>POS/POSMANAGER</NAME>
<HASDATABASE>TRUE</HASDATABASE>
<ENABLED>TRUE</ENABLED>
</Module>
</ModulesAvailable>

we r reading data from this file to check or uncheck the checkboxes


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Diagnostics;
using System.IO;
using System.Xml;



() cashier
() central server option button
() manager

[] install database checkbox

here checkbox must be unchecked for cashier and central server for manager its enabled
so we do this using this code








using System.Windows.Forms;

namespace ReadmeDilogue
{
public partial class ReadmeForm : Form
{
bool InstallDb = false;


public ReadmeForm(bool installDatabase)
{
InstallDb = installDatabase;



InitializeComponent();
}


private void ReadmeForm_Load(object sender, EventArgs e)
{
DataSet ds = new DataSet();
ds.ReadXml("D:\\PRS\\EXAMP\\New Folder\\ReadmeDilogue\\ReadmeDilogue\\DATA.xml");

try
{

if (Convert.ToBoolean(ds.Tables[0].Rows[0][2]) == false)
{
radioButton0.Enabled = false;
}
if (Convert.ToBoolean(ds.Tables[0].Rows[1][2]) == false)
{
radioButton1.Enabled = false;
}
if (Convert.ToBoolean(ds.Tables[0].Rows[2][2]) == false)
{
radioButton2.Enabled = false;
}
if (Convert.ToBoolean(ds.Tables[0].Rows[3][2]) == false)
{
radioButton3.Enabled = false;
}
for (int i = 0; i <= ds.Tables[0].Rows.Count-1; i++)
{
if (Convert.ToBoolean(ds.Tables[0].Rows[i][2]) == true)
{

if (Convert.ToBoolean(ds.Tables[0].Rows[i][1]) == true)
{
checkBox2.Enabled = true;
}
else
{
checkBox2.Enabled = false;
}
}

}
}
catch (Exception de)
{
Console.WriteLine("Exception: {0}", de.ToString());
}

}


//getting value of installDb (TRUE|FALSE)

public bool InstallDB
{
get { return this.checkBox2.Checked; }
}


public void change_color()
{
button1.BackColor = System.Drawing.Color.Gold;


}


private void button1_Click(object sender, EventArgs e)
{


MessageBox.Show(Convert.ToString(InstallDB));


this.Close();
}
private void checkBox2_CheckedChanged(object sender, EventArgs e)
{


}




/// <summary>
/// the install database checkbox will be disabled if FRE or CENTRAL SERVER is selected
/// here we are also unchecking the install database checkbox if it is alredy checked
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>



private void radioButton0_CheckedChanged_1(object sender, EventArgs e)
{
checkBox2.Checked = false;

if (radioButton0.Checked == false)
{
checkBox2.Enabled = true;
}
else if (radioButton0.Checked == true)
{

checkBox2.Enabled = false;
}
}

private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
checkBox2.Checked = false;

if (radioButton1.Checked == true)
{
checkBox2.Enabled = false;
}
else if (radioButton1.Checked == false)
{

checkBox2.Enabled = true;
}

}

// InstallDatabase Checkbox will be enabled if pos or posManager is selected

private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
if (radioButton2.Checked == true)
{
checkBox2.Enabled = true;
}
else if (radioButton2.Checked == false)
{

checkBox2.Enabled = false;
}
}

private void radioButton3_CheckedChanged(object sender, EventArgs e)
{
if (radioButton3.Checked == true)
{
checkBox2.Enabled = true;
}
else if (radioButton3.Checked == false)
{

checkBox2.Enabled = false;
}

}



}
}
Apr 10 '06 #2

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

Similar topics

3
by: arenaTR | last post by:
I have a group of five checkboxes that I need to check in a script after a post-operaiton. I was using the code: $drv1 = $_POST but if the user left checkbox "driving_1" empty, i get a php...
13
by: Adrian Parker | last post by:
I have a PHP generated page which displays X many records. Each record has a checkbox preceding it. The user checks several checkboxes, and hits a delete button. All the corresponding records...
6
by: terence.parker | last post by:
I currently have the following JS in my header: function checkall(thestate) { var checkboxes=eval("document.forms.EssayList.file_id") for (i=0;i<checkboxes.length;i++)...
2
by: Travis.Box | last post by:
I have an MS Access userform with 16 Check Boxes. Each of the checkboxes has a different option value, which coincides with the Check Box name (eg. cb01.OptionValue = 1). At the bottom of the...
7
by: Jaime Stuardo | last post by:
Hi all.. I have a DataGrid with checkboxes. In the header I have a "check all" checkbox. I'm wondering if there is an easy way to check all checkboxes using that checkbox. I could do it using...
0
by: Dilip | last post by:
hi all , i m trying to make such a tree view which specify some folder structure for installation i mean there is some folders mandatory. This is installation software. is based upon user...
10
by: rn5a | last post by:
All the rows in a DataGrid, including the Header, are accompanied with a CheckBox. I want that when the CheckBox in the Header is checked, then all the CheckBoxes should automatically get checked....
2
by: dkultasev | last post by:
Hello, I have small script which generates some listboxes. Their names are listXX (list01, list02, list03....). How to check if there are checked or not ? If I have 1 listbox and have it's name I...
1
Frinavale
by: Frinavale | last post by:
I'm working on an ASP.NET application using VB.NET for server side code. I have a GridView listing a bunch of stuff. Above the GridView I have a checkbox named "ChkBx_SelectAll". If this...
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: 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....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.