|
Try something like this:
Private Sub OnWControlContextMenuPopup(menu As ContextMenu)
RaiseEvent WControlContextMenuPopup(menu)
End Sub
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you, Richard. Is it correct to leave the "if... end if" part away completely?
|
|
|
|
|
Yes, that's correct; RaiseEvent handles that check for you.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks for helping, Richard - have a nice evening! ![Java | [Coffee]](https://codeproject.global.ssl.fastly.net/script/Forums/Images/coffee.gif)
|
|
|
|
|
C# and VB have differing syntax for doing the same thing. C# uses a syntax that is identical to calling an actual method. The error mesage tells you exactly what to do.
RaiseEvent WControlContextMenuPopup(menu)
|
|
|
|
|
Thank you for your answer.
Will I just ignore the whole "If..." part then? Because "If RaiseEvent..." doesn't work either. What is it actually supposed to do? Check for the result of an event???
|
|
|
|
|
Yes, you ignore the if code. All it does is check to see if a subscriber is attached before trying to raise the event. If VB.NET, with RaiseEvent , you don't have to do that.
|
|
|
|
|
Thank you for your help, and have a nice evening! 
|
|
|
|
|
1] Data Layers - Would you create one DAL class for each table? Each DAL would have a method for each CRUD operation.
For example I have a series of tables "Extra Work Headers", "Extra Work Material", "Extra Work Equipment"... and a couple more.
Would you put the methods for ALL of the Extra Work tables in one DAL class, or create a DAL class for each?
Right now I have a mix of this. Some DAL's have all methods for a group of tables, but lately I have been creating DAL's for each table.
2] Same question for BL's and Controllers. One Controller for a table group, or a separate Controller for each table?
I see pro's and con's to each approach.
What do you think?
If it's not broken, fix it until it is
|
|
|
|
|
Don't think in terms of "tables", think in terms of "operations" -- many operations require changes to multiple tables.
|
|
|
|
|
While I agree, part of the reason I'm asking is that I'm using a home grown tool that generates code. It creates the Table Scripts, Entities, DAL, BL, Controllers, Models, API Proxy code, etc.
Not sure how that would work from an 'Operation' based approach.
So what I think I hear you saying is to create these objects based on what needs to be done, rather than based off the table?
If it's not broken, fix it until it is
|
|
|
|
|
That's what I'm saying.
Kevin Marois wrote: home grown tool
I'm all for that.
Kevin Marois wrote: Not sure how that would work from an 'Operation' based approach.
Which is why I never use anything that claims it can do it. There is no substitute for hard work. Doing it the right way requires time and experience.
|
|
|
|
|
I'm working on a long term project. If I tailored the tool specifically for this project, I could make it work
If it's not broken, fix it until it is
|
|
|
|
|
I'm sure you'll learn things along the way, and that's a good thing. ![Java | [Coffee]](https://codeproject.global.ssl.fastly.net/script/Forums/Images/coffee.gif)
|
|
|
|
|
It kinda depends I guess. For example: When you have tables where each record is considered an "object". You should use one class/table. Examples: Persons, tickets, companies, products, ... things like that.
If you have tables that start having calculations or objects that are (complex) joins of tables or where multiple records can makeup one record, you should probably tackle that a little differently.
hope this helps.
|
|
|
|
|
Hello,
Does anybody know of a good code that can help with an eye tracking with a webcam?
I found only one code (TrackEye : Real-Time Tracking Of Human Eyes Using a Webcam) but it is from 5 years ago.
Basiclly, I'm looking for something to help a disable man to comunicate.
Thanks.
|
|
|
|
|
How to persists gridview textbox value when paging.
My situation is after user entered text in textbox they will click on the button to check their answer. But after i click gridview next page the previous page textbox value is not keep.
Thanks.
|
|
|
|
|
I am trying to insert (not add) data to a listview. The listview has 7 cols.
The code I am using is:
ListViewItem item = lvBOM.Items[2];
lvBOM.Items.Insert(2,"Hi");
This code is activated by a button click. The result is that a row is inserted but the word "HI" does not appear.
Full row select is set to true.
c# 2013 framework 4.51. Desktop app.
Thank you,
Duke
modified 9-Dec-13 10:43am.
|
|
|
|
|
I just tried that and it worked fine, is there something else that you are doing?
Veni, vidi, abiit domum
|
|
|
|
|
Thank you for replying.
The app has 2 listviews. The lvBOM listview has 7 cols.
I have supplied test data to all 70 rows in the first col only.
Here is the code for that:
for (int i = 0; i < intRCount; i++)
{
ListViewItem myItem = lvBOM.Items[i];//row
myItem.SubItems[1].Text = "5";//col
}
In the same button_click I followed that code with this code:
ListViewItem item = lvBOM.Items[2];//row
lvBOM.Items.Insert(2,"Hi");
The result is that the row is inserted but the data does not show. This data is test and only used to test the insert function.
|
|
|
|
|
I have four rows and three columns in my control. When I press the button it runs the following code:
ListViewItem item = listView1.Items[2];
listView1.Items.Insert(2, "Hi");
The row is added, and the word "Hi" appears in column 1. I can only assume that there is something in your code that you have not shown us, which is causing a problem.
Veni, vidi, abiit domum
|
|
|
|
|
Thank you for hanging in there with me..
I just started a new project. In the form load I have the following.
I still cannot get it to work.
private void Form1_Load(object sender, EventArgs e)
{
lvBOM.Clear();
lvBOM.Width = 451;
lvBOM.Columns.Add("", 0, HorizontalAlignment.Center);//skip first col
lvBOM.Columns.Add("Level", 40, HorizontalAlignment.Center); //level 1 is base
lvBOM.Columns.Add("Part Number", 100, HorizontalAlignment.Center);
lvBOM.Columns.Add("Description", 250, HorizontalAlignment.Center);
lvBOM.Columns.Add("Qty", 40, HorizontalAlignment.Center);
lvBOM.Columns.Add("", 0, HorizontalAlignment.Center);//InventoryMstrGUID
lvBOM.Columns.Add("", 0, HorizontalAlignment.Center); //InventoryMstrGUIDMAIN
lvBOM.FullRowSelect = true;
lvBOM.View = View.Details;
for (int i = 1; i <= 70; i++)//'initialize rows so grid looks like a grid
{
var lvi = new ListViewItem("");//will add to column(0) not being used
lvi.SubItems.Add("");
lvi.SubItems.Add("");
lvi.SubItems.Add("");
lvi.SubItems.Add("");
lvi.SubItems.Add("");
lvi.SubItems.Add("");
lvBOM.Items.Add(lvi);
}
ListViewItem item = lvBOM.Items[2];//row
lvBOM.Items.Insert(2, "Hi");
}
|
|
|
|
|
When you add the new item the text is placed in the first column. But you have chosen to hide that column, so the text never shows. Change the width of that column to something larger than 0 and it will work.
Veni, vidi, abiit domum
|
|
|
|
|
Thank you so much. But I apparently am having a fundamental problem.
ListViewItem item = lvBOM.Items[2];//<<<< this line inserts the row
lvBOM.Items.Insert(2, "Hi");//<<< I thought this line would select the 3rd col since the index is 2.
Column 0 is hidden = 0 index
column 1 is visible = 1 index
column 2 is visible = 2 index
I thought the "HI" would go into the 3rd column which has an index of 2.
What am I missing? How do I do this?
|
|
|
|
|
No, you are adding an Item into the second position of the view. You need to set the string into the second subitem position of the item that you add.
Veni, vidi, abiit domum
|
|
|
|