|
Size Isn't Important
I want do This Automatically
With Thanks
MHF
-- modified at 9:13 Sunday 20th August, 2006
|
|
|
|
|
|
|
Hello
1- RightClick on your setup project's name in the solution explorer
2- Click on Properties
3- Click on settings
4- Press "Prerequisite" button
5- Check .Net Framework
6- Check Windows Installer -recommended but not required-
7- check "download from same location as my application
8- Done!
Regards
|
|
|
|
|
|
Okay, well i got my app working, so thanks for any previous help.
I have the app open a file and build a treeview based on its contents. I have a button for this, which is redirected to a void containing all the code on building the treeview.
I also have a menu, which i named File inside this menu is a menu item called open. Quite simple so far, you click open, that also takes you to the void where the treeview is built.
BUT, when i click on File-Open, after the first node is added, it should a a subnode but instead i get the error message 'Object referemce not set to an instance of an object'
When i use the button i get no such error message and everything works perfectly. I just don't understand it.
|
|
|
|
|
I suggest you attach a debugger and find out what is null...
|
|
|
|
|
Its just adding a node, but its exaclty the same code that the button uses.
I create an object oNode, then go:
this.treeView1.SelectedNode.Nodes.Add(oNode)
When i use the button it works, its just when i use the menu item. It makes no sense.
|
|
|
|
|
Here is the relevant code upto the problem, and i don't wanna here nothin' about how messy the code is, or how i should use xml, cuz i don't wanna.
//Don't ask why its menu item 5
//This is the 'Open' menu item
void MenuItem5Click(object sender, System.EventArgs e)
{
this.Open();
}
//This is the button 'Load'
void Button1Click(object sender, System.EventArgs e)
{
this.Open();
}
//And this is the void they're pointing to
void Open()
{
this.treeView1.Nodes.Clear();
this.openFileDialog1.InitialDirectory = @"C:\Program Files\Datel\Action Replay Code Manager\local_codelists\";
this.openFileDialog1.Filter = "XML files (*.xml)|*.xml|All files (*.*)|*.*";
this.openFileDialog1.Title = "AR DS Code Editor";
this.openFileDialog1.ShowDialog();
if(this.openFileDialog1.FileName.Length > 0)
{
string FileLine;
FileStream FS = File.Open(this.openFileDialog1.FileName, FileMode.Open, FileAccess.Read);
StreamReader SR = new StreamReader(FS, true);
FileLine = SR.ReadLine();
while(FileLine != null)
{
int trim = FileLine.IndexOf("<");
FileLine = FileLine.Remove(0, trim);
switch(FileLine)
{
case("<game>"):
{
string oName = SR.ReadLine();
int indexOfStart = oName.IndexOf('>');
int indexOfEnding = oName.LastIndexOf('<');
oName = oName.Substring(indexOfStart+1, indexOfEnding-indexOfStart-1);
string oID = SR.ReadLine();
indexOfStart = oID.IndexOf('>');
indexOfEnding = oID.LastIndexOf('<');
oID = oID.Substring(indexOfStart+1, indexOfEnding-indexOfStart-1);
Cheat oNode = new Cheat();
oNode.sType = "game";
oNode.sName = oName;
oNode.sID = oID;
oNode.Text = oName;
this.treeView1.Nodes.Add(oNode);
oNode.ForeColor = Color.Red;
this.treeView1.Select();
break;
}
case("<cheat>"):
{
string oName = SR.ReadLine();
int indexOfStart = oName.IndexOf('>');
int indexOfEnding = oName.LastIndexOf('<');
oName = oName.Substring(indexOfStart+1, indexOfEnding-indexOfStart-1);
string oCode = SR.ReadLine();
indexOfStart = oCode.IndexOf('>');
indexOfEnding = oCode.LastIndexOf('<');
oCode = oCode.Substring(indexOfStart+1, indexOfEnding-indexOfStart-1);
Cheat oNode = new Cheat();
oNode.sType = "cheat";
oNode.sName = oName;
oNode.sCode = oCode;
oNode.Text = oName;
this.treeView1.SelectedNode.Nodes.Add(oNode); //This is where the error occurs for the menu item
oNode.ForeColor = Color.LimeGreen;
break;
}
-- modified at 17:08 Sunday 20th August, 2006
|
|
|
|
|
The Undefeated wrote: this.treeView1.SelectedNode.Nodes.Add(oNode); //This is where the error occurs for the menu item
Then just check why SelectedNode is null.
I suspect it has maybe some to do with: TreeView.HideSelection property.
|
|
|
|
|
I'll check that, but it should'nt make a difference, its the same code.
Its like, hey this is a nice pen, and you try it out, it works yay!
You go home, it doesnt work anymore.
You go back to where you found it, it works again!
Its madness.
|
|
|
|
|
No setting it to true, removing it all togeather, it made no difference.
|
|
|
|
|
Hi
Don't use SelectedNode property to get the root node.As you can see selectedNode can be null depending on the way you interact with your UI.
It's better to get a reference to the root node when it's created and hold it until it might be needed.
You can use a map with a unique key to perform that if you are loading parent nodes up front.
For example:
<br />
IDicitonary parents=new Hashtable();<br />
foreach(FileLine fl in GetFileLines())<br />
{<br />
TreeNode fileLineNode=new TreeNode();<br />
fileLineNode.Text=fl.Name;<br />
parents.Add(fl.ID,fileLineNode);<br />
}<br />
later in your code you can reach a parent node using it's ID
Or if you are loading children nodes exactly after a parent node there is no need to use a map.
For example:
<br />
foreach(FileLine fl in GetFileLines())<br />
{<br />
TreeNode parentNode=new TreeNode();<br />
foreach(Game g in GetGames(fl))<br />
{<br />
TreeNode gameNode=new Node();<br />
parentNode.Nodes.Add(gameNode);<br />
}}<br />
I recommend you to use a xml file instead of a plain text file something like:
<File>
<FileLine>
<Game>
</Game>
</FileLine>
</File>
Then you can take advantage of XML Document object to open your file and query your nodes
-- modified at 2:10 Monday 21st August, 2006
|
|
|
|
|
I can't change the style of the xml file it has to stay the way it is.
I no longer do SelectedNode.Nodes.Add()
I the root node being a game, it is now gNode and all cheats etc are added to that.
Still have the problem though.
|
|
|
|
|
WIAT! it works now, could have been what you said, about the selectednode property, but either way, thanks.
|
|
|
|
|
Hi
I am still using VS 2003, and I want to use horizontal splitter in my window form. How can i do that? thanks..
|
|
|
|
|
Hello
I don't use VS2003 yet i think the splitter control should work fine for you -not the splitcontainer control-.
This code is copied from MSDN documentaion with some modifications to make the splitter horizontal as you asked:
private void CreateMySplitControls()
{
TreeView treeView1 = new TreeView();
ListView listView1 = new ListView();
Splitter splitter1 = new Splitter();
treeView1.Dock = DockStyle.Bottom;
splitter1.Dock = DockStyle.Bottom;
splitter1.MinExtra = 100;
splitter1.MinSize = 75;
listView1.Dock = DockStyle.Fill;
treeView1.Nodes.Add("TreeView Node");
listView1.Items.Add("ListView Item");
this.Controls.AddRange(new Control[]{listView1, splitter1, treeView1});
}
So, you add a splitter, and dock the other control to bottom -or top-, then dock your splitter like it, and the other control that will be in the other pane should be docked as fill or as the opposite direction.
Regards
|
|
|
|
|
|
give me some example code for chekers game
sadfs
|
|
|
|
|
Hello
Such easy information should not be asked here in the forums The forums were made for direct specific technical problems.
Why don't you google first!! Try search for "checker source code"
Regards
|
|
|
|
|
Hi everybody!
I wrote a search option for a listview.
when the item is found I used these commands to show the user where is the item he is looking for:
this.lvUser.Items[yPosition].Selected = true;
this.lvUser.Items[yPosition].Focused = true;
the problem is that I want the listview to scroll to the specific item I just focused on. currently if I cannot see the item (I need to scroll to it), the listview wouldn't scroll to it.
does anyone have any idea how to scroll the listview to the focused item?
Thanks!!!
|
|
|
|
|
Hello
Once you know which item you want to scroll to, use the ListView.EnsureVisible(int index) with the index of your item, or use ListViewItem.EnsureVisible() method called directly by your item
Regards
|
|
|
|
|
Hey! Thanks!
|
|
|
|
|
Can anyone tell me what is the meaning of this message when I try to update BLOB data into an ms access database file via OleDbCommand? the update of BLOB
field performs fine but I receive the following Error message:
"The program encountered an error trying to perform the command.if the problem persists, contact the program vendor for a possible solution."
My Code is as below :
public void UpdateOutLettDoc(byte[] DocImage,string LettId)
{
try
{
LoadTable("OutLetters");
if (Conn.State != ConnectionState.Open)
Conn.Open();
string upCmdString = "UPDATE OutLetters SET LettPage=@DocImage WHERE LettId=" + LettId;
OleDbCommand OleCmm = new OleDbCommand(upCmdString, Conn);
OleCmm.Parameters.Add("@LettPage", OleDbType.Binary, (int)DocImage.Length, "LettPage");
OleCmm.Parameters["@LettPage"].Value = DocImage;
OleCmm.ExecuteNonQuery();
if (Conn.State == ConnectionState.Open)
Conn.Close();
}
catch(OleDbException ex)
{
MessageBox.Show(ex.ToString());
}
}
As you see I used try{} block to catch exceptions but this Error is never detected by try{} block.
Please Help me!
-- modified at 5:19 Sunday 20th August, 2006
|
|
|
|
|
Maybe type of the exception is something different from OleDbException and as a result,the catch block won't catch it.Check typeo of the exception object.
If it's an OleDbException exception it has a ErrorCode property that usually contains the error code from OleDb provider (and it might be useful)
|
|
|
|