|
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.
So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thank you, of course, I will do my part. I just ask you if you have any coding idea then please help me. I don't tell you to do my full project.
actually, I don't have any good c# programming knowledge I'm trying to learn from the internet. And this is not my school or work project.
I already read excel using OleDb and tried LINQ to shorting data but I still not able to.
|
|
|
|
|
And there you are making a huge mistake.
Stop trying to "learn from the internet" and get a good book (or better go on a course) - Addison Wesley do some good ones, as do Wrox and Microsoft. Even download this: Dot Net Zero[^] which will give you a lot of it.
The problem is that learning from the internet is pretty much random - and if any of that is YouTube then most of it is produced by people who know little (if any) more than you do, and have no idea who to make a video or teach. So you miss a lot of stuff that you don't know that you need to know - like SQL Injection in the Bill thread code. You are trying to run before you can walk - and that's a porr way to get started.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
If you've loaded the menu items from the spreadsheet, there must be some indicator in the data telling you which child item belongs to which parent item. If you know that one thing, building a hierarchical menu is pretty easy.
Beyond that, you haven't indicated what your data looks like, so we can't possibly help you any further.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Load each "child" LISTVIEW (query menu item collection) as the parent's listview "selection changed" event fires. Cascades to the lowest level.
This is an example of (hand-rolled) "data virtualization".
The Master said, 'Am I indeed possessed of knowledge? I am not knowing. But if a mean person, who appears quite empty-like, ask anything of me, I set it forth from one end to the other, and exhaust it.'
― Confucian Analects
|
|
|
|
|
You need to start by describing the structure/format in which the data is available in C#. Is it in a DataTable ? a CSV file ? a 2d array ? or ... ?
You can, of course, fill the top-level ComboBox when the Form loads, since its contents do not change.
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
modified 10-Jun-19 5:31am.
|
|
|
|
|
Thanks for your reply. But i have not so much knowledge in c#. If you give some coding help then it's very helpful for me
|
|
|
|
|
I'll be happy to assist you, but, if you can't tell me what format the data imported from Excel is in ... or, show me the working code you have now that imports the data: I can't offer any useful advice.
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
I imported from excel using OleDb. now I can't be shorting data. this code now I'm trying..
string stringconn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + tbxSelect.Text + ";Extended Properties=\"Excel 8.0;HDR=Yes;\";";
OleDbConnection conn = new OleDbConnection(stringconn);
if (tbxSelect.Text != "")
{
OleDbDataAdapter da = new OleDbDataAdapter("Select * from [" + tbxChoice.Text + "$]", conn);
DataTable dt = new DataTable();
dt.Clear();
da.Fill(dt);
for (int i = 0; i < dt.Rows.Count; i++)
{
string firstRow = dt.Rows[i]["A"].ToString();
if (firstRow != "")
{
cmbRow1.Items.Add(firstRow);
if (!firstRow.Equals(Row1))
{
RowIndex_1++;
}
Row1 = firstRow;
}
MessageBox.Show(i.ToString(),RowIndex_1.ToString());
}
for (int j = 0; j < dt.Rows.Count; j++)
{
string secondRow = dt.Rows[j]["B"].ToString();
if (secondRow != "")
{
cmbRow2.Items.Add(secondRow);
if (!secondRow.Equals(Row2))
{
RowIndex_2++;
}
Row2 = secondRow;
}
MessageBox.Show(j.ToString(), RowIndex_2.ToString());
}
for (int k = 0; k < dt.Rows.Count; k++)
{
string secondRow = dt.Rows[k]["C"].ToString();
if (secondRow != "")
cmbRow3.Items.Add(secondRow);
}
for (int l = 0; l < dt.Rows.Count; l++)
{
string secondRow = dt.Rows[l]["D"].ToString();
if (secondRow != "")
cmbRow4.Items.Add(secondRow);
}
for (int m = 0; m < dt.Rows.Count; m++)
{
string secondRow = dt.Rows[m]["E"].ToString();
if (secondRow != "") ;
}
MessageBox.Show((dt.Rows.Count).ToString());
conn.Close();
}
else
MessageBox.Show("Er");
|
|
|
|
|
Don't do it like that! Never concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Always use Parameterized queries instead.
When you concatenate strings, you cause problems because SQL receives commands like:
SELECT * FROM MyTable WHERE StreetAddress = 'Baker's Wood' The quote the user added terminates the string as far as SQL is concerned and you get problems. But it could be worse. If I come along and type this instead: "x';DROP TABLE MyTable;--" Then SQL receives a very different command:
SELECT * FROM MyTable WHERE StreetAddress = 'x';DROP TABLE MyTable; Which SQL sees as three separate commands:
SELECT * FROM MyTable WHERE StreetAddress = 'x'; A perfectly valid SELECT
DROP TABLE MyTable; A perfectly valid "delete the table" command
And everything else is a comment.
So it does: selects any matching rows, deletes the table from the DB, and ignores anything else.
So ALWAYS use parameterized queries! Or be prepared to restore your DB from backup frequently. You do take backups regularly, don't you?
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Note: it's possible the Excel range you show has 'split row; and, there are other ways you can create simulated hierarchies in Excel: that's why is crucial to examine the structure of the DataTable.
You need to do this: insert this code after the line beginning: da.Fill(dt);
for (int i = 0; i < dt.Rows.Count; i++)
{
DataRow row = dt.Rows[i];
Console.Write($"row: {i}\t");
for (int j = 0; j < dt.Columns.Count; j++)
{
Console.Write($"{row[j]}\t");
}
Console.WriteLine();
} Put a break-point just after this inserted code. Run the code. When it stops at the break-point, copy the output in the Console Window, and save it so you can study it. Post it here.
Study the structure revealed, and start thinking of what has to happen to map that to the ComboBoxes.
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
Thank you! I think it is a great idea. I will try and let's see
|
|
|
|
|
Data comes with this format. what is a good way to rearrange it
row: 0 menu1 submenu11 child111 item1111
row: 1 item1112
row: 2 child112 item1121
row: 3 item1122
row: 4 item1123
row: 5 submenu12 child121 item1211
row: 6 child122 item1221
row: 7 item1222
row: 8 menu2 submenu21 child211 item2111
row: 9 item2112
row: 10 item2113
row: 11 child212 item2121
row: 12 child213 item2131
row: 13 submenu22 child221 item2211
row: 14 menu3 submenu31 child311 item3111
row: 15
row: 16
row: 17
row: 18
row: 19
row: 20
|
|
|
|
|
That's an important step: start thinking about how you would use the 'menu, 'submenu, 'child, and 'item labels to create the tree structure.
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
To be sure the structure shown is accurate, we need to check for the presence of "DBNull" values: please run this code and show the result:
for (int i = 0; i < dt.Rows.Count; i++)
{
DataRow row = dt.Rows[i];
Console.Write($"row: {i}\t");
for (int j = 0; j < dt.Columns.Count; j++)
{
var cvalue = row[j];
string cstr = cvalue is DBNull ? "DBNull" : row[j].ToString();
Console.Write($"{cstr}\t");
}
Console.WriteLine();
}
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
I able to solve the problem... thank you very much
i just scan ever row then match its child row. like this
menu1---submenu11---child111----item1111
menu1---submenu11---child111----item1112
menu1---submenu11---child112----item1121
|
|
|
|
|
Overly simplified:
public class MyMenuItem
{
public MyMenuItem Parent { get; set; }
public string Header { get; set; }
public List<MyMenuItem> Children { get; set; }
public MyMenuItem(string header, MyMenuItem parent=null)
{
this.Parent = parent;
this.Header = header;
this.Children = new List<MyMenuItem>();
}
}
List<MyMenuItem> MenuItems = new List<MyMenuITem>();
Populate the MenuItems appropriately, and have a ball. I'm not sure why you're putting menu items into comboboxes, but whatever...
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
|
Yeah, I read that before, but it still doesn't answer my "I'm not sure why" remark.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
OP is probably thinking "listviews" (as you said, the combo part is not much use in this case).
The Master said, 'Am I indeed possessed of knowledge? I am not knowing. But if a mean person, who appears quite empty-like, ask anything of me, I set it forth from one end to the other, and exhaust it.'
― Confucian Analects
|
|
|
|
|
Even if that was the case, what has it got to do with a listview?
The whole question kinda sucks...
|
|
|
|
|
I looked at his "picture".
It's not all that silly. Like tumblers ... if you can imagine ....
The Master said, 'Am I indeed possessed of knowledge? I am not knowing. But if a mean person, who appears quite empty-like, ask anything of me, I set it forth from one end to the other, and exhaust it.'
― Confucian Analects
|
|
|
|
|
Before any further reading, i want to apologise for posting this question here, and im aware im hurting my reputation by doing this, but im really desperate. If is very unappropriated, i will delete it myself. But if you can help me with a solution to my problem... oh boy. I wrote to malwarebytes Forum the same question,and now im waiting. But on other AV websites, its just problematic to even log in to their forums, from my side at least: avast,avg,norton. You guys here i really respect and i hope you can help me more than 'dedicated' chaps out there.
I wonder if is a MANUAL way possible of cleaning those 'infections', that i strongly suspect is just a parameter written in the executable file. Or if only automatic way exists... Either way, i need a way to preserve my bunch of stuff that i'm so scared to loose at this time.
------------------ here is my problem:
I keep the instalation software that i tested and i liked. I am doing it for years. I have a special folder with all my instalations kits, and i gathered in time somewhere like 200 perhaps. So when i have to reinstal my windows, i reinstall my usual software from that folder. Thats it's purpose, a backup.
Some time ago, i received a troian (virus), and i manage to clean it yesterday from my C partition and from windows too. But i scanned my D drive also, where this folder i have with all the instalation kits. And nearly all the executables are found infected with this latest trojan and from other old ones i had in the past. I am a bit desperate about this situation because i can not get back the specific software versions i gathered anymore.
Is there a posibility to clean all these installers? But not cleaning by deletion or quarantine, but cleaning the actual virus that is inside them/or/attach to them ? And leave intact my instalation kit, ready to use another time, uncorupted or damaged?
I used: MalwareBytes free version and also AVG antivirus free version. Both softwares didnt clean eficiently from windows scan. Only from boot scan! But im refering for the elimination of all windows infections. Drive D is well scanned from windows and eficient enough.
These are the viruses that are infecting my installers:
win32: Gardih (this was the latest one)
win32: Crypt-SJB [Trj] (this was the latest one)
win32: Evo-gen [Susp]
win32: Rootkit-gen [Rtk]
win32: MalwareX-gen [Trj]
win64: Trojan-gen
FileRepMalware
MSIL:GenMalicious-AAS [Trj]
BV: ExitWindows-K [Trj]
BV: Agent-BGV [Expl]
Other: Malware-gen [Trj]
Thank you !
|
|
|
|
|
Would I risk it? No. Unless your antivirus - and this if nothing else should convince you to get one and use it - can disinfect all the files for you, there is no good way to remove a mess of virii from your system.
Me? I'd reformat and restore the whole thing from a clean backup just to be sure - I've seen cases in the past when multiple virii make it next to impossible to get rid of them all and a complete reset is the best - and quickest - way to proceed.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
It's the only way to be sure[^].
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|