|
Please how can I achieve this in a datagridview that when data is fetched from database, that each combo box will show a dropdown of the value of the Quantity it has fetched.
for an instance, if x gets 10,12,15,9,5,3
the first combobox will show a dropdown of 1 to 10, the second will show 1 to 12,...
DataGridViewComboBoxColumn dv = new DataGridViewComboBoxColumn();
dv.HeaderText = "myCombobox";
cmd.Connection = conn;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "Select * from Toolz";
conn.Open();
reader = cmd.ExecuteReader();
while (reader.Read())
{
x = Reader.GetInt32(3);
}
foreach (DataGridViewRow dvx in dataGridView3.Rows)
{
y = Convert.ToInt32(dvx.Cells[3].Value.ToString());
}
for (g = 0; g < y; g++) ;
List<int> xl = new List<int>();
xl.Add(g);
foreach (DataGridViewComboBoxColumn dvx in dataGridView3.Rows)
{
dv.Items.Add(xl);
}
Keep the Dream Alive..
|
|
|
|
|
Please do not cross post.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I am testing a communicator frame where I have blocks of message contents which are pulled from database using visual studio telerik framework.
each message in database represents a Div on the UI.
each div has path something like
`
Pages.CareMechanix.FrameCommunicator.DOBDiv
Pages.CareMechanix.FrameCommunicator.DOBDiv0
Pages.CareMechanix.FrameCommunicator.DOBDiv1
Pages.CareMechanix.FrameCommunicator.DOBDiv2
`
I am getting the number of divs by `Pages.CareMechanix.FrameCommunicator.Find.AllByAttributes("class=cm-alert").Count;`
I am verifying if the number of messages in database is equal to number of divs.
In similar way, I want to verify the content in each div content is equal to corresponding message in database.
I would definitely not want to access each div content separately by path like below:
`Pages.CareMechanix0.FrameCommunicator.**DOBDiv**.AssertContent().TextContent(ArtOfTest.Common.StringCompareType.Contains, "| DOB: 00/27/1974" + "Patient ID: " + PatientID + sub);
Pages.CareMechanix0.FrameCommunicator.**DOBDiv0**.AssertContent().TextContent(ArtOfTest.Common.StringCompareType.Contains, "| DOB: 00/27/1974" + "Patient ID: " + PatientID + sub);
Pages.CareMechanix0.FrameCommunicator.**DOBDiv1**.AssertContent().TextContent(ArtOfTest.Common.StringCompareType.Contains, "| DOB: 00/27/1974" + "Patient ID: " + PatientID + sub);`
I would like to run a loop for the count to verify the text content.
**I am not sure of how to get each div content using a loop.**
Can someone please help me on this?
Please let me know if I am not clear anywhere.
I can explain.
|
|
|
|
|
Hello,
I am trying to work out the best way to play a video in full screen without the form displaying..
I have added the axWindowsMediaPlayer player to my form but I just cannot work out how to make it play full screen.
I have tried the code:
axWindowsMediaPlayer1.windowlessVideo = true;
But it seems to make no difference.
Ideally I am trying to make the video play full screen without any controls.
Can anyone suggest the best way to achieve this please?
Thanks
Trev
|
|
|
|
|
A quick Google shows me this AxWindowsMediaPlayer.fullScreen property[^]
if that doesn't work as expected I think you need to elaborate on your requirements
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
Hi Simon,
Many thanks.
Apologies, I should have said I did try that as well..
When I do I get an error:
here is my code:
private void axWindowsMediaPlayer1_Enter(object sender, EventArgs e)
{
axWindowsMediaPlayer1.URL = @"C:\Users\trevo_000\Documents\visual studio 2013\Projects\Lance\Video Player\Loop.mp4";
axWindowsMediaPlayer1.fullScreen = true;
axWindowsMediaPlayer1.windowlessVideo = true;
}
And I get the error of:
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in AxInterop.WMPLib.dll
Additional information: Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
Trev
|
|
|
|
|
You might want to read the documentation on the FullScreen property[^] and make sure you're setting up the MediaPlayer within the limits specified.
|
|
|
|
|
ok. can I go back to basics please? as I think I might be doing this wrong...
What am I trying to achieve...?
I am trying to write an app that, when it starts, immediately goes fullscreen and starts playing a video.
I then want the video to keep looping unless I tell the "video player" to change video.
I mostly write websites and APIs so my knowledge is way out of date in this area.
Is WMP the way to do this?
Thanks
|
|
|
|
|
Yes it is the way to do this.
No, it does not get you out of reading the documentation.
|
|
|
|
|
Member 4169628 wrote: immediately goes fullscreen All the examples I've seen set the fullscreen mode only when the state of the Player is Playing!
|
|
|
|
|
Hi,
i have a very strange problem with CheckBox ComboBox Extending the ComboBox Class and Its Items[^]
First, i have two of them on my form. When I check a Item in one of them, i call a method that reloads the entries of the second ComboBox consider which Item was selected in the first ComboBox, after that the method checks the Items which was checked before the entries of the second ComboBox were reload. This should work in two ways.
It works fine when I Select one Item in the first ComboBox and one item in the second ComboBox (My Method checks the "earlier checked Items of the other ComboBox") but when I select two or more Items in the second ComboBox the method dont checks the "earlier checked Items". I hope it was unterstandable, my english isn't the best...please ask when you have any questions.
Here is my Code.
1. ComboBox (cbArticle) CheckBoxCheckedChanged Event:
private void cbArticle_CheckBoxCheckedChanged(object sender, EventArgs e)
{
if (cbArticle.Text != "Artikel auswählen")
{
cbArticle.ForeColor = SystemColors.WindowText;
GetQueryType(gbTimespan.Controls.OfType<RadioButton>().FirstOrDefault(n => n.Checked));
string[] arrMethods = cbMethod.Text.Split(',');
cbMethod.Items.Clear();
FillMethods();
cbMethod.CheckBoxCheckedChanged -= cbMethod_CheckBoxCheckedChanged;
for (int i = 0; i < arrMethods.Length; i++)
{
try
{
cbMethod.CheckBoxItems[arrMethods[i].Trim()].Checked = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
cbMethod.CheckBoxCheckedChanged += cbMethod_CheckBoxCheckedChanged;
}
else
{
cbArticle.ForeColor = SystemColors.GrayText;
FillMethods();
if (finished)
{
GetQueryType(gbTimespan.Controls.OfType<RadioButton>().FirstOrDefault(n => n.Checked));
}
}
}
2. ComboBox (cbMethod) CheckBoxCheckedChanged Event:
private void cbMethod_CheckBoxCheckedChanged(object sender, EventArgs e)
{
if (cbMethod.Text != "Methode(n) auswählen")
{
cbMethod.ForeColor = SystemColors.WindowText;
GetQueryType(gbTimespan.Controls.OfType<RadioButton>().FirstOrDefault(n => n.Checked));
string[] arrArticles = cbArticle.Text.Split(',');
cbArticle.Items.Clear();
FillGroupCodes();
cbArticle.CheckBoxCheckedChanged -= cbArticle_CheckBoxCheckedChanged;
for (int i = 0; i < arrArticles.Length; i++)
{
try
{
cbArticle.CheckBoxItems[arrArticles[i].Trim()].Checked = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
cbArticle.CheckBoxCheckedChanged += cbArticle_CheckBoxCheckedChanged;
}
else
{
cbMethod.ForeColor = SystemColors.GrayText;
FillGroupCodes();
if (finished)
{
GetQueryType(gbTimespan.Controls.OfType<RadioButton>().FirstOrDefault(n => n.Checked));
}
}
}
When I debug the Code it works fine every time. I can see that the checkbox CheckedStatus is checked. But when the Method has ended and my Application switches back to the UI the CheckBoxes aren't checked... I call no other Methods (checked in debugger) but I can see that the CheckBoxComboBox.cs opens in Visual Studio it jumps in the following Code Blocks.
public partial class CheckBoxComboBox : PopupComboBox
{
#region EVENTS & EVENT HANDLERS
public event EventHandler CheckBoxCheckedChanged;
private void Items_CheckBoxCheckedChanged(object sender, EventArgs e)
{
OnCheckBoxCheckedChanged(sender, e);
}
#endregion
#region EVENT CALLERS and OVERRIDES e.g. OnResize()
protected void OnCheckBoxCheckedChanged(object sender, EventArgs e)
{
string ListText = GetCSVText(true);
if (DropDownStyle != ComboBoxStyle.DropDownList)
Text = ListText;
else if (DataSource == null)
{
Items[0] = ListText;
CheckBoxItems[0].ComboBoxItem = ListText;
}
EventHandler handler = CheckBoxCheckedChanged;
if (handler != null)
handler(sender, e);
}
...
}
[ToolboxItem(false)]
public class CheckBoxComboBoxItem : CheckBox
{
#region PROTECTED MEMBERS
protected override void OnCheckedChanged(EventArgs e)
{
if (_CheckBoxComboBox.DataSource != null)
{
PropertyInfo PI = ComboBoxItem.GetType().GetProperty(_CheckBoxComboBox.ValueMember);
PI.SetValue(ComboBoxItem, Checked, null);
}
base.OnCheckedChanged(e);
if (_CheckBoxComboBox.DataSource != null)
{
string OldDisplayMember = _CheckBoxComboBox.DisplayMember;
_CheckBoxComboBox.DisplayMember = null;
_CheckBoxComboBox.DisplayMember = OldDisplayMember;
}
}
#endregion
Please help me...I am totally frustrated after sitting 2-3 days on this issue...
|
|
|
|
|
If you have a question on an article, the best place to ask is in the forum at the bottom of that article: Comments[^]
The author of the article is usually the best person to help with the code they've written.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Of course, but I think the autho of this article is no longer active.
|
|
|
|
|
i hardly use generic. so anyone can explain what is generic and when one should use it. i like to know in what kind of situation developer use generic? i like to request to give some sample code which explain the good usage of generic.
what is the meaning of the below line
public class User : DBObject<User>
{
}
what is the meaning of this line specially
DBObject<User>
tbhattacharjee
|
|
|
|
|
Read this for an introduction and you'll get the idea (I hope): An Introduction to C# Generics[^]
In a nutshell: Generics enable one to make very general type definitions where types of subcomponents/parameters can be changed without changing the code of the type that uses them.
Cheers!
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
thanks for the help
but u did not answer for this line
public class User : DBObject<User>
{
}
what is the meaning of this line specially
DBObject<User>
tbhattacharjee
|
|
|
|
|
The meaning of "DBObject<User>" is the collection of User types,and the declaration of the public class User is an inherited class of DBObject<User>.
public class User : DBObject<User>
{
}
"Indian Hacker"
Debabrata Panigrahi.
|
|
|
|
|
Hi Debabrata,
thanks for answer. still things is not very clear to me. u said collection....ok. i have one more request. can you please write small full sample code similar to my situation which would explain well the usage like
DBObject<User>
looking for your help. thanks
tbhattacharjee
|
|
|
|
|
Read the link that was provided in the first answer to your question. That answers it all. Better still, actually read a book on this stuff. There are free ones available that are excellent. Charles Petzold's .NET Book Zero[^] is a great resource to help you get started. Seriously, you have to start doing some of this for yourself. If you don't, your career is going to go nowhere because all you have learned is that other people know things and you don't.
|
|
|
|
|
He did answer it. You actually have to read the associated article and then think about it for a bit. You've been here and asked enough questions by now to know that we expect you to do some of the work yourself.
|
|
|
|
|
I am trying to telnet a HProCurve J9279A Switch but i am getting some unknown characters in the login prompt when i am writing the response in text file . Please let me know how to handle this and remove these junk characters from string . I can say these are some escape sequense which in not recognized by string .
Please register your products now at: www.ProCurve.com
[1;24r[1;1H[24;1HUsername: [?25h[24;1H[?25h[24;11H[24;11H[?25h[24;11H
Please help to remove thse unknown characters in above strings and command outputs. any help will be appreciated...
|
|
|
|
|
Ok, those are VT100 / VT220 terminal control sequences and then consist of ASCII characters:
ESC [ n ; n x Where:
ESC is Hex 1B
[ is [
n is a number, in ASCII digits: '0' (hex 30) to '9' (hex 39) repeated
; is ;
x is a command code which tells the terminal what to do Some parts are optional, and question marks can be included as well!
The command code is an ASCII character which (IIRC) will be upper or lower case 'a' to 'z'.
The command code tells the system what to do with the whole command: r is a "Set scrolling region" command, H is cursor positioning, and so forth.
(You can find out what they do here: http://epsfiles.intermec.com/eps_files/eps_man/977047037c.pdf[^] - section 8)
To remove them, you will have to parse the string yourself, and find the start and end of the sequence: it may be possible to do it with a regex, but I've never tried (And am not about to! )
You looking for sympathy?
You'll find it in the dictionary, between sympathomimetic and sympatric
(Page 1788, if it helps)
|
|
|
|
|
A quick thought (it's amazing what else you can think of when in a boring meeting) gives me this regex:
\x1B\[\??\d+(;\d+)?[a-zA-Z] That with a regex Replace operation replacing with a empty string should get rid of them. Probably.
You looking for sympathy?
You'll find it in the dictionary, between sympathomimetic and sympatric
(Page 1788, if it helps)
|
|
|
|
|
Thanks.... Its working 
|
|
|
|
|
You're welcome!
You looking for sympathy?
You'll find it in the dictionary, between sympathomimetic and sympatric
(Page 1788, if it helps)
|
|
|
|