|
You can read the text file as line by line and use the substring to spilt out ID from the string. use the following
<br />
File.ReadAllLines Method <br />
string[] s=String.Split (' ')<br />
then Compare every 3rd element in the array (s) ( C.ID) to check whether the CID is existing in the file or not.
Note : space delimit is important between the columns in the file
|
|
|
|
|
use xml file to store and retrieve value.it's a Good Practice to use xml file for structure data
sameer
|
|
|
|
|
If XML is not an option, you should have some kind of delimiter that distinguishes the fields. Then split the fields by the delimiter.
|
|
|
|
|
I was looking at the article written by Ian Giffen that he had written about the DragDrop event handler at http://www.codeproject.com/cs/miscctrl/LANDragDrop.asp[^ and I have developed a quite interesting challenge regarding how the application functions.
I am requesting that a DragDrop expert to download the source code application and to make the following modifications to the source code in order to reach the dilemma that I have encountered.
Make the following changes to the source code in the Form1 form.
Add a second control to the application like so:
public Form1()
InitializeComponent();
TestControl NewCtrl = new TestControl();
NewCtrl.Left = 50;
NewCtrl.Top = 50;
TestControl NewCtrl2 = new TestControl();
NewCtrl2.Left = 150;
NewCtrl2.Top = 50;
this.Controls.Add(NewCtrl);
this.Controls.Add(NewCtrl2);
DragDropHandler.Initialize();
DragDropHandler.RegisterControl(this, true, true);
DragDropHandler.RegisterControl(panel1, true, true);
DragDropHandler.RegisterControl(NewCtrl, false, false);
DragDropHandler.RegisterControl(NewCtrl2, false, false);
DragDropHandler.RegisterControl(button1, false, true);
}
Then in the TestControl.cs file make the following changes:
public TestControl()
{
InitializeComponent();
this.Width = 50;
this.Height = 50;
}
to make each control bigger. Now here is the dilemma. I would like each of the two controls: NewCtrl and NewCtrl2 to be able to act as parents to each other. That is, I would like to be able to drop one of the controls onto the other.
I have attempted to change the following code:
DragDropHandler.RegisterControl(NewCtrl, false, false);
DragDropHandler.RegisterControl(NewCtrl2, false, false);
to...
DragDropHandler.RegisterControl(NewCtrl, true, true);
DragDropHandler.RegisterControl(NewCtrl2, true, true);
and I have tried to catch the control in the DragOver event, but to no avail. The DragDrop event handler needs to have access to the parent control if one of the controls has been dropped onto the other control. This is the challenge. I am requesting the assistance of a DragDrop guru to resolve this dilemma. Please help!!!
|
|
|
|
|
How do you clear the write-protection on folders? I need to get a file from the IE cache to modify it. Thanks for any help.
-Fred Morstatter
|
|
|
|
|
Why would you want to change a file in cache? Why not just change the file on the web server? The next time your site is visited, the cache will be changed.
|
|
|
|
|
I wrote a custom menu control that accepts keyboard movement.
I have a form with a button on it.
When I click the button I see my menu pop up below the button.
The problem is that the focus shifts between the button and the custom control whenever I press an arrow key.
How do I keep other controls from stealing focus away from my custom control.
I don't want to disable other controls.
I want to maintain focus in my custom control
I've tried to set the handled and the suppressKeyPress functionality in the event but the button still grabs focus for every other keypress.
Any ideas?
Thanks,
Brad
|
|
|
|
|
I found it... here is the magic override...
protected override bool IsInputKey(Keys key)
{
switch (key)
{
case Keys.Up:
case Keys.Down:
case Keys.Right:
case Keys.Left:
return true;
}
return base.IsInputKey(key);
}
|
|
|
|
|
hello,
how can I use AdjustTokenPrivileges en C# ?
thanks
Vincent
|
|
|
|
|
I find this : it is ok and run correctly
public struct TOKEN_PRIVILEGES
{
public LUID Luid;
public int Attributes;
public int PrivilegeCount;
}
//Ajustement du token privilege
[DllImport("advapi32.dll", CharSet = CharSet.Auto)]
public static extern int AdjustTokenPrivileges(int tokenhandle, int disableprivs,
[MarshalAs(UnmanagedType.Struct)]ref TOKEN_PRIVILEGES Newstate, int bufferlength,
int PreivousState, int Returnlength);
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
public struct LUID
{
public int LowPart;
public int HighPart;
}
[StructLayout(LayoutKind.Sequential)]
public struct TOKEN_PRIVILEGES
{
public LUID Luid;
public int Attributes;
public int PrivilegeCount;
}
|
|
|
|
|
Hi all
How can i access a specified field's value in a crystal report by code
eg : like how can i increment a value of a specified field in a crystal report by code (in an event(Button_click))
thanks
SalehMahmoud
|
|
|
|
|
One listing is enough. We're not blind.
|
|
|
|
|
|
Hi all
How can i access a specified field's value in a crystal report by code
eg : like how can i increment a value of a specified field in a crystal report by code (in an event(Button_click))
thanks
SalehMahmoud
|
|
|
|
|
Hi!
I have handheld laser barcode scannr (Metrologic MS951). It is connect to COM1 (it works becouse I have test it by MetroSet program .
Whot do I have to do to get reach of (read) this barcode number which the scaner will read?
Thanks.
|
|
|
|
|
Try to read some barcode using Hyperterminal from Windows. Just set the port to COM1 and set some parameter like Baudrate, etc... If it works, then you can use class SerialPort in C# to read from COM Port.
|
|
|
|
|
Hi all
How can i access a specified field's value in a crystal report by code
eg : like how can i increment a value of a specified field in a crystal report by code (in an event(Button_click))
thanks
SalehMahmoud
|
|
|
|
|
Hi all
How can i access a specified field's value in a crystal report by code
eg : like how can i increment a value of a specified field in a crystal report by code (in an event(Button_click))
thanks
SalehMahmoud
|
|
|
|
|
I'm learning how to program C#, but I'm having very little luck. Everytime I search around I can never find the right code snippets to help my program.
What i'm trying to do is take "A"
and add 3 (+3)
and come up with "D" "D"
So I'm pretty much trying to take characters convert to numbers and add the binary value and then convert back to characters.
A +3 = D
Unicode
Anyhelp would be greatly appreciated, If not, I'll keep looking and post up a solution if I can find one.....
|
|
|
|
|
You can cast a character to an int to get the character code:
char foo = 'A';<br />
int bar = (int)foo;
After changing the character code you can cast the int to char.
---
b { font-weight: normal; }
|
|
|
|
|
Good job doing his homework for him. Hopefully in a few years you can reap your reward by having to work with him.
led mike
|
|
|
|
|
If the homework was to convert a character to an integer, yes, then I have done his homework. I doubt, however, that his homework is quite as simple as that.
Hopefully in a few years he has moved beyond basic data conversion, and will be able to actually do something with the data.
---
b { font-weight: normal; }
|
|
|
|
|
Finally Got it.....Thanks for all the Help Guffa, I was making it harder than it was, but once I got the foreach loop and char 'A' to int the program almost finished itself.
Here's the completed code snippet
private void btnEn_Click(object sender, EventArgs e)
{
string result = "";
foreach (char abc in txtUn.Text)
{
result = result + Convert.ToChar(Convert.ToInt16(abc) + 3);
}
txtEn.Text = result;
}
public void btnDe_Click(object sender, EventArgs e)
{
string result = "";
foreach (char abc in txtUn.Text)
{
result = result + Convert.ToChar(Convert.ToInt16(abc) - 3);
}
txtDe.Text = result;
}
|
|
|
|
|
Works beatifully thanks for the quick help. But I'm now trying to convert multiple characters in one text box.
Such as....
ABC +3 =DEF
I've tried string and looping things, but can't seem to manipulate it correctly.
|
|
|
|