|
Hi all,
I think it's quite easy to delete single selection of rows in a listview.
I usually do this :
DELETE FROM Purch WHERE PurchID
LIKE '" + lvPurch.Items[lvPurch.FocusedItem.Index].SubItems[0].Text + "' "
I wonder how to delete multiple selection of rows in a Listview Control ?
Learn from yesterday, live for today, hope for tomorrow
|
|
|
|
|
Try with this Code:
int CMultipleRowDeleteView::DeleteSelectedRowsFixed(void)
{
int nSelRows = GetListCtrl().GetSelectedCount();
if(!nSelRows)
return(0);
int* pnArrayOfSelRows = new int[nSelRows];
if(!pnArrayOfSelRows)
return(0);
int nTemp = nSelRows;
POSITION pos = GetListCtrl().GetFirstSelectedItemPosition();
int i = GetListCtrl().GetNextSelectedItem(pos);
while (i != -1)
{
nTemp = nTemp-1;
pnArrayOfSelRows[nTemp] = i;
i = GetListCtrl().GetNextSelectedItem(pos);
}
for(int j=0; j < nSelRows; j++)
{
GetListCtrl().DeleteItem(pnArrayOfSelRows[j]);
}
delete(pnArrayOfSelRows);
pnArrayOfSelRows = NULL;
return(1);
}
Hope this will Help you.
Regards,
Satips.
|
|
|
|
|
;Pfirst you need to get the selected rows :
object a = ListView.SelectedRows....
then you can delete it by calling the method Remove(); :
a[0].Remove();
if it's not working, so try :
a.Clear();
GoodLuck
|
|
|
|
|
Hi All,seems a great challenge,until now seems no one of some senior programmers in big consulting companies found a solution.
Problem:
We've got a complex User control, which is organized in 5 classes:
Shape
Corner
Color
Designer
UiTypeEditor
in "Color" we've got around 20 Properties indicating Different Brushes properties based on fixed value ranges.(PathBrush Distance from Center,a
Linear Gradient property based on an Enum which let User choose only stepped values as "Top,TopLeft" etc. as position for colors..)
We got in Corner,something similar to "Color class" in which we define all proportions and values only for having an independent object which act
as corner for a rounded rectangle.
In the "Shape Class" we have finally a Graphics access with the method for creating and colorizing our Graphic UserControl.
We reached the ability to Have a "Color" Category in PropertyGrid,but ONLY using all I explained in first class in file.
We tried using PostFilterProperties driven by a "FillingType" property(PathGradient,LinearGradient,Solid etc..)If we select from one of those values
we're able to show ONLY needed properties for type selected.(Ex. If Master Property is set to "Solid Fill Type",then Properties under It will be only
Color Solid and Transparency(Alpha)....If We select "LinearGradient",all Solid Fill Values disappear and appear in propertygrid ColorGradientA and ColorGradientB and so on for textureFill etc..)All that Works but:
For viewing result of switching we need to dispose control and re-drop from toolbox,we are NOT YET ABLE to expose to property grid something is coming
from other classes in same namespace(We got ALL Geometric values and methods in "Shape Class" and we would like to "pass" as fillpath(argument)
Our FillType selected by PropertyGrid.We tried Invalidate(),Refresh(),but nothing,and ever with First class.We would like to be able to
public class Shape
{
/// only generic snippet here for example...
public int var;
public int CornerRadius
{
get{...}
set{...}
}
}
//here real snippets
public class Color
{
public static string[] PropertiesToRemove = new string[13];
public enum FillTypeEnumerator
{
Solid,
LinearGradient,
PathGradient,
Texture
}
FillTypeEnumerator FillTypeValue = FillTypeEnumerator.Solid;
[Category("Color")]
public FillTypeEnumerator FillType
{
get { return FillTypeValue; }
set
{
FillTypeValue = value;
switch (FillTypeValue)
{
case FillTypeEnumerator.Solid:
PropertiesToRemove.SetValue("LinearGradientTransparencyA", 0);
PropertiesToRemove.SetValue("LinearGradientTransparencyB", 1);
PropertiesToRemove.SetValue("LinearGradientColorA", 2);
PropertiesToRemove.SetValue("LinearGradientColorB", 3);
PropertiesToRemove.SetValue("LinearGradientPositions", 4);
PropertiesToRemove.SetValue("PathGradientCenterColorTransparency", 5);
PropertiesToRemove.SetValue("PathGradientCenterColor", 6);
PropertiesToRemove.SetValue("PathGradientSurroundColor", 7);
PropertiesToRemove.SetValue("PathGradientSurroundColorTransparency", 8);
PropertiesToRemove.SetValue("PathGradientFocusDistance", 9);
PropertiesToRemove.SetValue("PathGradientCenterPosition", 10);
PropertiesToRemove.SetValue("TextureImage", 11);
break;
case FillTypeEnumerator.LinearGradient:
PropertiesToRemove.SetValue("SolidTransparency", 0);
PropertiesToRemove.SetValue("Solid", 1);
PropertiesToRemove.SetValue("PathGradientCenterColorTransparency", 2);
PropertiesToRemove.SetValue("PathGradientCenterColor", 3);
PropertiesToRemove.SetValue("PathGradientSurroundColor", 4);
PropertiesToRemove.SetValue("PathGradientSurroundColorTransparency", 5);
PropertiesToRemove.SetValue("PathGradientFocusDistance", 6);
PropertiesToRemove.SetValue("PathGradientCenterPosition", 7);
PropertiesToRemove.SetValue("TextureImage", 8);
break;
case FillTypeEnumerator.PathGradient:
PropertiesToRemove.SetValue("LinearGradientTransparencyA", 0);
PropertiesToRemove.SetValue("LinearGradientTransparencyB", 1);
PropertiesToRemove.SetValue("LinearGradientColorA", 2);
PropertiesToRemove.SetValue("LinearGradientColorB", 3);
PropertiesToRemove.SetValue("LinearGradientPositions", 4);
PropertiesToRemove.SetValue("TextureImage", 5);
PropertiesToRemove.SetValue("SolidTransparency", 6);
PropertiesToRemove.SetValue("Solid", 7);
break;
case FillTypeEnumerator.Texture:
PropertiesToRemove.SetValue("LinearGradientTransparencyA", 0);
PropertiesToRemove.SetValue("LinearGradientTransparencyB", 1);
PropertiesToRemove.SetValue("LinearGradientColorA", 2);
PropertiesToRemove.SetValue("LinearGradientColorB", 3);
PropertiesToRemove.SetValue("LinearGradientPositions", 4);
PropertiesToRemove.SetValue("PathGradientCenterColorTransparency", 5);
PropertiesToRemove.SetValue("PathGradientCenterColor", 6);
PropertiesToRemove.SetValue("PathGradientSurroundColor", 7);
PropertiesToRemove.SetValue("PathGradientSurroundColorTransparency", 8);
PropertiesToRemove.SetValue("PathGradientFocusDistance", 9);
PropertiesToRemove.SetValue("PathGradientCenterPosition", 10);
PropertiesToRemove.SetValue("SolidTransparency", 11);
PropertiesToRemove.SetValue("Solid", 12);
break;
}
this.Invalidate();
}
}
//SolidFill
int SolidTransparencyValue = 255;
[Category("Color")]
[Editor(typeof(TrackBarEditor), typeof(UITypeEditor))]
public int SolidTransparency
{
get { return SolidTransparencyValue; }
set { SolidTransparencyValue = value; this.Invalidate(); }
}
ColorDialog FillSolidColorDialog = new ColorDialog();
[Browsable(true)]
[Category("Color")]
public Color Solid
{
get { return Color.FromArgb(SolidTransparency, FillSolidColorDialog.Color); }
set { FillSolidColorDialog.Color = value; this.Invalidate(); }
}
}
}
Why for Example I cannot see in property Grid "Solid" Property and I'm be able to see ONLY Shape properties?
What we have to do?IExtenderProvider?
What needs PropertyGrid in System.Reflection for searching also in 2nd,3rd,n class?Service,a CustomDesigner?
Is possible Idictionary is filled ONLY by properties of 1st class? Simply re-populating the "Default Designr PropertyDescriptorCollection I would be able to...seems not...
Please we're in the middle of the Sea..try to Win this challenge!
Thanks to all for Patience!
Frank Drebin
|
|
|
|
|
HI
the problem is this :
i have made a one page presentation in MS PowerPoint with effects
i would like to displat it throw a web browser control
till know it's fine, but the scroll bar that comes with the web browser is annoying (of cuorse i had it disabled - it's property )
but it us still appear when i run th APP
HELP(not the beatles, hhhhhh)
THNKS
;P;P;P;P
kobkob
|
|
|
|
|
|
hhhhhhhh
been there already
i did try to make flash movie with alot of sucsess
BUT couldent load it throw the web control (i probably need macomedia to be instaled)
by the way : before the PPT is presented there's a
save load cancal dialog box, CAN I GET RIDE OF HIM????
THNKS anyway
kobkob
|
|
|
|
|
How do you make a WinForm minimize to the taskbar in the lower-right corner? Also, how can you make it so that the minimize, maximize, and close buttons are disabled on the form?
-----
Note: *** Never give me an answer have anything to do with Visual Studio. I don't have this program, and it'll be that way for a long, long time. ***
|
|
|
|
|
That's the system tray. There are CP articles on making your app's icon appear in the system tray.
max29297 wrote: Also, how can you make it so that the minimize, maximize, and close buttons are disabled on the form?
You can remove them entirely in the designer, if you remove just minimise or just maximise, then it will disable instead of being removed.
Oh - sorry. You're not using visual studio for some bizarre reason ( the C# express edition is free ). The form has properties which you can set manually, I believe they are called MinimizeButton, MaximizeButton and the close one refers to the entire menu, I forget it's name.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
OK, I've updated my sig.
-----
*** Never give me an answer having anything to do with Visual Studio. I don't have this because I have two computers, one being my dad's mac, which is connected to the internet, the other being my pc, which is, sadly, not connected to the internet. The setup for the Visual C# program I think is called a "bootstrap" program, and it needs to connect to the internet to install the program. THEREFORE I cannot install this program onto my pc.***
|
|
|
|
|
OK - now that I understand the problem, you can get the express editions on CD from Microsoft. I recommend it.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
How can you associate an icon with a certain type of file, so that when you view the file in Windows Explorer, the file will be displayed using that icon?
-----
Note: *** Never give me an answer have anything to do with Visual Studio. I don't have this program, and it'll be that way for a long, long time. ***
|
|
|
|
|
That's done in the registry, in the same section that handles what file to use to open a program if you double click on it.
HKEY_CLASSES_ROOT / Word.Document.8 / DefaultIcon
for example.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
Thanks, that article is exactly what I needed.
-----
Note: *** Never give me an answer have anything to do with Visual Studio. I don't have this program, and it'll be that way for a long, long time. ***
|
|
|
|
|
Hi
I am trying to write a small utility where fill the form and click submit button automatically.
I am using mshtml to get all the information and press the button. But how do i get the button name from code below? Any ideas?
<form method="post" action="/cgi-bin/add_posting.pl"><br />
<fieldset><br />
<br />
<input type="hidden" name="pid" value="0001068190921181587792429822"/><br />
<input type="hidden" name="sms_me" value=""/><br />
<input type="hidden" name="room_type" value=""/><br />
<input type="hidden" name="house_type" value=""/><br />
<br />
<input type="hidden" name="num_bedrooms" value=""/><br />
<input type="hidden" name="contract_type" value=""/><br />
<br />
<button type="submit" class="submit">submit your ad >></button><br />
<br />
<input type="hidden" name="posting_id" value=""/><br />
<input type="hidden" name="current_live_date" value=""/><br />
</fieldset><br />
</form>
Thanks
Irfan
I am still learning
|
|
|
|
|
A regex that looks for a button with type="submit" ? Of course, this button doesn't have a name, unless you mean the text on the button ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Because this button does not have name. I was not sure how to press it. So i should be using regex ?
I am still learning
|
|
|
|
|
OK, so regex isn't going to help you. You're not really asking C# forms questions, you're asking how to interact with a web page, in the browser control, right ? I believe you can just find the submit button(s) using javascript, without needing a name.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Irfan Faruki wrote: fill the form and click submit button automatically.
You dont really need to click the button, but submit the form.
Give the form some id. Then simple JS document.myForm.submit() should work.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
Thanks for the help guys
dnh... Can you show an example if you don't mind? I am a newbie at c# and dont knwo Js
Thanks
I am still learning
|
|
|
|
|
i send 6 arranged datas from outside to c#.net with serialport.and i use serialport_datareceived(..) .i must get these datas in the c# arranged.but i cant get datas with sequence in the c#.how can i solve this problem?my code is this:i mean first data will be
value[1]=first data coming from outside.
value[2]=second data coming from outside
....
i wish i could explain my problem
private void myform_Loaded(object sender, EventArgs e)
{
seriport = new SerialPort();
seriport.DataReceived+=new SerialDataReceivedEventHandler(this.seriport_DataReceived);
seriport.PortName = "COM4";
seriport.DataBits = 8;
seriport.BaudRate = 9600;
seriport.Parity =System.IO.Ports.Parity.None;
seriport.StopBits = System.IO.Ports.StopBits.One;
seriport.ReceivedBytesThreshold =6;
seriport.ReadBufferSize =10000;
seriport.WriteBufferSize =10000;
if (seriport.IsOpen)
seriport.Close();
seriport.Open();
}
private void seriport_DataReceived(objectsender,SerialDataReceivedEventArgse)
{
byte[] values={0,0,0,0,0,0,0,0};
seriport.Read(values, 0, 6);
//icall my functioun here.
}
|
|
|
|
|
Is the data coming into the port delimited? Have you tried using seriport.ReadLine(), then parsing out the line?
|
|
|
|
|
i have 6 datas.and each of data between 0-255 (just one byte).if i use serialport.readline() so how can i separate my datas in visual c#?
for example my datas:
10
245
100
12
250
8
when i use serialport_readline() so how can i seperate these_another question is that will i get datas with arranged?
|
|
|
|
|
If you are not using a delmiting character, such as a comma or colon, then you would not be able to seperate the values. What does the string look like when it is sent to the port?
|
|
|
|
|