|
While you're at it you can also try to manually calculate Taylor series approximations to several decimal places to cut down on processing time? lol
|
|
|
|
|
I am trying to access checked Items in a checkedListbox from another method.Problem is, using "Selecteditem" and "SelectedIndex" does not work, it appears as if there aren't any items selected from the list. is there any other way I can read from the CheckedBoxList list or What am i doing wrong? Please help
|
|
|
|
|
Without seeing your code it is not easy to offer any suggestion. Normally just using myCheckedListBox.SelectedIndex should work.
Please post the code where you are trying to do it, so that people can try to help you.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Is this WinForms? If so, are you getting confused between SelectedItems and CheckedItems?
CheckedListBox.CheckedItemCollection checkedItems = checkedListBox.CheckedItems;
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Good spot!!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Lets name the checklistbox as table list.whenever an item is checked or unchecked just add them to a data table(_selectedTables).
<br />
private void tableList_ItemCheck(object sender, ItemCheckEventArgs e)<br />
{ <br />
string names = tableList.GetItemText(tableList.Items[e.Index]);<br />
<br />
CheckState currentState=e.NewValue;<br />
<br />
if (currentState.ToString() == "Checked")<br />
{<br />
DataRow newRow = _selectedTables.NewRow();<br />
_selectedTables.Rows.Add(newRow);<br />
newRow["Table"] = names;<br />
}<br />
else<br />
{<br />
DataRow[] dr = _selectedTables.Select("Table = '" + names + "'");<br />
if (dr.Length > 0)<br />
_selectedTables.Rows.Remove(dr[0]);<br />
}<br />
}<br />
And then use this method to retrieve the selection
public DataTable ReturnSelectedTables<br />
{<br />
get<br />
{<br />
return _selectedTables;<br />
}<br />
}
Hope this helps you.
|
|
|
|
|
Hi All
can anyone help me for searching in phone book? I use text file for saving data.
I want to find all names that contains the input character. I dont now how do it.
pleas give me a solution.
|
|
|
|
|
First thing you will have to do is to read the data from the file. You may want to read line by line looking for the characters in question. Alternatively you could read the entire file into some sort of List/Array/Dataset etc and then use the methods of those objects to search. Take a look at the foregoing classes to get some ideas of what is possible.
|
|
|
|
|
Which version of Windows Mobile platform you are using?
I think you can try with ContactCollection sample in MSDN [^]if it gives you any hint.
|
|
|
|
|
I want to create an application that show 2 webbrowsers control in one app like they run in 2 app.
When i use webbrowsers in 2 applicaion i think they have session but in one app it is same. How i can create 2 Tab in my app with 2webbrowsers with separate sessions?
|
|
|
|
|
amir19 wrote: create an application that show 2 webbrowsers control in one app
I am not very clear about your requirement. Are you creating any Windows application where you want to have two embeded browser controls? Then it's possible.
Anyway, please clearly specify.
|
|
|
|
|
Yes it is correct. I created two webbrowsers in a windows application. When i open same site with these ones they have same session. I want to they behave like when they are in two applications. I opened my app two times and browsers had separate sessions and cookies.
|
|
|
|
|
Amir,
Now your problem is clear to me..But it seems to be difficult one
I found few things which might consider for your design.
1. The issue you are mentioning is kinda feature of your browser. I think you are using some IE with version < 8. This similar session feature could be referred as SessionMerging. IE 8.0 is coming with a feature where you can create some new sessions (please look into this article[^]). But I am not yet sure how you are going to force that new session. Anyway, keep searching on that.
2. There might be very "optimistic" approach of creating your next WebBroser from a separate process. if you can achieve (not very sure on this) this then this might help.
Other thing, it's better to have another design keeping this limitation in mind.
Or wait for someone who can help you better.
|
|
|
|
|
It's considered bad manners around here to post your message on multiple forums. Pick one and stick with. Delete the other since it has no responses.
only two letters away from being an asset
|
|
|
|
|
|
hello frnds,
i am a beginner in c# .i was doing a task in which i had a string of datas like "a,b,c,d,e" and to which i have to enter in a dropdown list when i click a button .........
can anyone help me out in this problem.....plzzzzzzzz.....
|
|
|
|
|
1.) Split [^]the string
string _data = "a,b,c,d,e";
string [] _splittedData = _data.Split(new Char [] {','});
2.) Loop through the array and add it to the dropdownlist.
foreach(string _stringData in _splittedData)
{
MyDropDownList.items.add(_stringData);
}
Btw, this is very basic and you should rather buy a good book on C# and start reading that. This would help you to become a better programmer.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hello,
i have a problem. i have a List<string> and in another Thread a Loop which is running and checking the List (Foreach-Loop). Now, the loop is running and a new item is added to the list - > i get an Exception, and my application breaks!
So, how to solve this problem?
|
|
|
|
|
You will have to make it "thread safe" (Google will help here), but basically you need to lock your list before traversing it, and also before attempting to add to it. See here for starters[^]
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Hi,
Im making a trial of one of my applications, and i want the user to only be able to run the application 5 times..
now, my original plan had been:
int numint = 1;
TextWriter trialWrite = new StreamWriter("oote.oost");
trialWrite.WriteLine(numint+1);
trialWrite.Close();
So it would add +1 to the value of numint each time the application loads, but its not working right, and it doenst add to the number inside the text (oost) file in question.
I also tried +1 but that doesnt work either.
Its in the form_load event.
Can anyone tell me how to add +1 to the value of the number already in my text file?
thanks,
Ben.
|
|
|
|
|
You need to set the value of numint by reading the value in "oote.oost" BinaryReader.ReadInt16/32/64(). To do this you will need to use a BinaryWriter (BinaryWriter.WriteInt16/32/64() ) instead of your StreamWriter , but that is better since the file will be slightly obfuscated for casual meddlers.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Ok, Can you give a code example please?
Thanks,
Ben.
|
|
|
|
|
OK.
This is to go in the Form.Load, as per your original question:
private void Form1_Load(object sender, EventArgs e)
{
string fileName = "oote.oost";
int numint = 0;
if (File.Exists(fileName))
{
BinaryReader binReader = new BinaryReader(File.Open(fileName, FileMode.Open));
try
{
numint = binReader.ReadInt32();
}
catch (EndOfStreamException ex)
{
MessageBox.Show("Unable to read [numint]", "File Read Error");
}
finally
{
binReader.Close();
}
}
if (numint >= 5)
{
MessageBox.Show("Sorry too many runs", "Limit Exceeded");
Application.Exit();
}
else
{
BinaryWriter binWriter = new BinaryWriter(File.Open(fileName, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None));
try
{
binWriter.Write(numint + 1);
}
catch
{
}
finally
{
binWriter.Flush();
binWriter.Close();
}
}
}
However, I do not like doing Application.Exit() from within the Form.Load handler. I cannot give any meaningful reason, it just seems wrong to me to do all the form loading and initializing stuff, if you aren't going to let them in.
So as an alternative you can do pretty much the same in the Main() method of the Program class. Here:
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
string fileName = "oote.oost";
int numint = 0;
if (File.Exists(fileName))
{
BinaryReader binReader = new BinaryReader(File.Open(fileName, FileMode.Open));
try
{
numint = binReader.ReadInt32();
}
catch (EndOfStreamException ex)
{
MessageBox.Show("Unable to read [numint]", "File Read Error");
}
finally
{
binReader.Close();
}
}
if (numint < 5)
{
BinaryWriter binWriter = new BinaryWriter(File.Open(fileName, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None));
try
{
binWriter.Write(numint + 1);
}
catch
{
}
finally
{
binWriter.Flush();
binWriter.Close();
}
Application.Run(new Form1());
}
else
{
MessageBox.Show("Sorry too many runs", "Limit Exceeded");
}
}
}
Hope this helps!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Now all the user has to do to go beyond 5 runs is either completely remove the file, edit it with a hex editor, restore it after each run, or reinstall the program.
this answered the question, however you are well aware is not the way to implement trial limitations. real solutions would use access to a web server, or a hardware dongle.
|
|
|
|
|
I'm Aware of this fact, and I'm currently working on solutions to it
By hardware dongle do you mean memory stick?
One of the solutions im looking at is creating the file with installation, then using a If statement to see if the file exists or not, if it does, then it writes to the file, if the file doesnt exist then the application will exit.
True all the user would have to do then is make another file. But it should stop casual snoopers, All I really want it for is to make sure my friend doesnt leg it with a BETA release of some of my software, nothing too big.
thanks All,
Ben.
|
|
|
|