|
Sure
SELECT param1, param2, param3, param4, ISNULL(SourceVideoClip, '')
FROM MyTable
c.SourceVideoClip=reader.GetString(4).Trim();
only two letters away from being an asset
|
|
|
|
|
Hello experts,
I'm trying to have a certain context menu popup when right clicking a ListView's headers, and another context menu popup when right clicking inside of the ListView.
Problem is I can't find a way to monitor right clicks on the headers.
The ColumnClick event only gets fired when left clicking, and the MouseUp, MouseDown, MouseClick, etc. events are only fired when the mouse is bellow the headers (inside of the ListView).
Any suggestions?
Thanks in advance,
Shy.
|
|
|
|
|
I've developed a simple workaround...
Here it is in case someone finds this post in the future...
The ContextMenuStrip property of the ListView is initially set to hold the context menu used when clicking the headers.
Assuming that the ListView is called "list", the context menu for the headers is called "ctxtHeaders", and the context menu for the body of the list is called "ctxtBody", here is the implementation:
private void list_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
list.ContextMenuStrip = ctxtBody;
}
private void ctxtBody_Closing(object sender, ToolStripDropDownClosingEventArgs e)
{
list.ContextMenuStrip = ctxtHeaders;
} The code is settings the list's context menu to the body's context menu every time it is about to be shown (i.e. when the right mouse botton is clicked).
Then, when the context menu is closed, the list's context menu is set to the headers context menu.
|
|
|
|
|
Hello world,
I'm working with vs 2005 using a typed dataset. I have a table, 'Trans', that has a relationship with 3 different parent tables ('Participants', 'Service Types', & 'Dependents'). In my actual database, Trans has a foreign key called 'serviceTypeID' which is the primary key in ServiceTypes. I just added a relationship with the other tables in visual studio. The problem lies in a column I created named 'service' in the Trans table. It's expression is Parent(FK_Transactions_ServiceTypes).service. This works fine when I run my program but as soon as I try to configure my TransactionsTableAdapter, I get this weird error 'Cannot find the parent relation 'FK_Transactions_ServiceTypes''. Mind you, I didn't rename the relation or even create it. It was done automatically and all the spelling is correct. Like I said, the expression works when I run my program. Anybody else run across this problem?
Lester
http://www.lestersconyers.com
|
|
|
|
|
Hi all
I am working with datagrid of 2005.I have 10 rows in it.It has three columns.
Id,Name,ParentId
Now my scenario is that if first records id is the parent id for all other 9 records, i need to select entire rows.for that i was using grid.select property but its not working,means its not getting selected
i am giving the partial code..can anyone give me what is gng wrong in this code
Advnaced thanks
for (int tmpCnt = 0; tmpCnt < AuthorisedTable.Rows.Count; tmpCnt++)
{
//if (dataGridAuthorised.IsSelected(tmpCnt) )//
if (AuthorisedTable.Rows[tmpCnt]["Type"].ToString()=="Meeting")
{
string tmpOtherID = (AuthorisedTable.Rows[tmpCnt]["EventId"].ToString());
for (int tmpRace = 0; tmpRace < AuthorisedTable.Rows.Count; tmpRace++)
{
if (AuthorisedTable.Rows[tmpRace]["OtherID"].ToString() == tmpOtherID)
{
this.dataGridAuthorised.Select(tmpRace);
}
}
}
}
Regards
DilipRam
|
|
|
|
|
Try to replace the
this.dataGridAuthorised.Select(tmpRace);
to
this.dataGridAuthorised.Rows[tmpRace].Selected=true;
And check the selection mode property.
Visit my blog at http://dotnetforeveryone.blogspot.com/
|
|
|
|
|
Hi thanks for the reply, but i am not getting dataGridAuthorised.Rows property
Any idea
Regards
DilipRam
|
|
|
|
|
I have some Form - and i have some User Control on it.
I have also 6 button on the form and 4 button on the User Control.
In Form code i have some function that collect all the event from all the button ( The Form button and also from the User Control Button) .
My problem is that i need to know in run time witch button send me the event.
I cant use the "Tag" of the button because i using it for other target.
How to do it ?
How can i know if the button is Form relevant or relevant User control ???
Thanks for any help.
|
|
|
|
|
You can use the sender to find out which button was clicked
((Button)sender).Name<br />
|
|
|
|
|
I cant use this way because there are some button with same name on the Form and on the userControl.
I need some way to know who the owner of this button.
Is it the Form OR is it any of the userControls ....
|
|
|
|
|
Use the sender and the ((Control)sender).Parent property together to know which control is.
Visit my blog at http://dotnetforeveryone.blogspot.com/
|
|
|
|
|
Hello,
I would use the 'as' operator for the casting.
Button actButton = sender as Button;
if(actButton!=null)
{
actButton.Name
if(actButton.Parent!=null)
{
if(actButton.Parent is YourUserControl_1)
{
}
else if(actButton.Parent is YourUserControl_2)
{
}
}
}
All the best,
Martin
|
|
|
|
|
|
All the best,
Martin
|
|
|
|
|
You can also check out this thread, which asked almost the same question.
http://www.codeproject.com/script/comments/forums.asp?forumid=387161&Page=3&userid=157870&mode=all&select=2094274&df=100&fr=231.5#xx2094274xx[^]
As others have already pointed out, casting the sender to a Button and then looking at it's properties (name, tag, etc.) to determine which button it is will be the best way to go.
The question that it seems no one asked is why do you need to route 10 buttons through the same event handler? Surely all 10 buttons don't do the same thing? If they actually do different things and you are trying to use 1 event handler to do some common things (like logging, for instance) you would probably be better off to use separate event handlers for each button and then have each event handler call a separate common method.
|
|
|
|
|
hi there,
i made a database on my D drive but i reinstalled the windows and sql server , so what i do now to load that database in my new sql server instance??
Becoming Programmer...
|
|
|
|
|
You need to "attach" the database. This is an operation available in Enterprise Studio (SQL 2000) and SQL Server Manager (SQL 2005). Have a quick search in your help to find out how.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Attach it in your SQL Server.
I Love SQL
|
|
|
|
|
Hello..
I'm having a device on the serial port sending a HEX string (34 46 FF 30) when I use programs like AccessPort I see the string like this "4Fÿ0"
But when I try to get the string in my aplication I get "4F?0" why???
I need to get the "FF/ÿ" HEX/CHAR in my aplication.
The aplication is going to read the 3char in the string and present this in a progressbar.
So I need to get the 3char a Desimal value from 0 to 255.
To do this I use the following code:
strig x = ComPort.ReadExisting();
Console.WriteLine(Convert.ToInt32(ConvertToHex(x.Substring(2, 1)), 16));
public string ConvertToHex(string asciiString)
{
string hex = "";
foreach (char c in asciiString)
{
int tmp = c;
hex += String.Format("{0:x2}", (uint)System.Convert.ToUInt32(tmp.ToString()));
}
return hex;
}
Sorry for my english, hope you understand what I need..
Best regards Svein Jarle
|
|
|
|
|
With this code sample, I get the 4Fÿ0 back
using System;
using System.Collections.Generic;
using System.Text;
namespace TestBytes
{
class Program
{
static void Main(string[] args)
{
Encoding test = Encoding.Default;
string x = "\x34\x46\xFF\x30";
Console.WriteLine("{0}", x);
byte[] bytes = test.GetBytes(x);
for(int i = 0 ; i < bytes.Length ; i++)
{
Console.Write("{0:X2} ", bytes[i]);
}
Console.Write("\n");
Console.ReadLine();
}
}
}
Maybe you are on a different encoding.default ANSI code page on your PC ?
|
|
|
|
|
First of all you must figure out whether the bytes on the cable represent binary
data or textual data. From what you have shown, it seems binary (FF is not
a regular ASCII/ANSI character).
If you want to see it as textual data, you must use the encoding/decoding that
matches the data; only then can you successfully apply the methods ReadChar,
ReadLine, Read(char[]) and the like. The default encoding for SerialPort is ASCII,
which would fail to understand a byte value of FF. See SerialPort.Encoding property.
If you want to capture it as binary data (which implies no interpretation whatsoever)
you should use ReadByte or Read(byte[]). The read will always succeed. But you
would still have to decide how exactly you will deal with the bytes that you have
got; you can be sure though they are identical to what has been received from
the cable.
|
|
|
|
|
Hello..
Thanks for the help.. It is no working..
<br />
if (ComPort.BytesToRead >= 1){<br />
int bytes = ComPort.BytesToRead;<br />
byte[] buffer = new byte[bytes];<br />
ComPort.Read(buffer, 0, bytes);<br />
string hex = ByteArrayToHexString(buffer);<br />
if (hex.Length >= 48) {<br />
Console.WriteLine(hex);<br />
Console.WriteLine(HexStringToCharString(hex));<br />
Console.WriteLine(Convert.ToInt32(ConvertCharToByte(HexStringToCharString(hex).Substring(4, 1)), 16));<br />
}<br />
<br />
}<br />
<br />
<br />
<br />
public string ConvertCharToByte(string asciiString)<br />
{<br />
string hex = "";<br />
foreach (char c in asciiString)<br />
{<br />
int tmp = c;<br />
hex += String.Format("{0:x2}", (uint)System.Convert.ToUInt32(tmp.ToString()));<br />
}<br />
return hex;<br />
}<br />
<br />
private string HexStringToCharString(string s)<br />
{<br />
StringBuilder sb = new StringBuilder(s.Length / 3);<br />
for (int i = 0; i < s.Length; i += 3)<br />
{<br />
sb.Append(Convert.ToString((char)ushort.Parse(s.Substring(i, 2), System.Globalization.NumberStyles.HexNumber)));<br />
}<br />
return sb.ToString();<br />
}<br />
<br />
private byte[] HexStringToByteArray(string s)<br />
{<br />
s = s.Replace(" ", "");<br />
byte[] buffer = new byte[s.Length / 2];<br />
for (int i = 0; i < s.Length; i += 2)<br />
buffer[i / 2] = (byte)Convert.ToByte(s.Substring(i, 2), 16);<br />
return buffer;<br />
}<br />
<br />
private string ByteArrayToHexString(byte[] data)<br />
{<br />
StringBuilder sb = new StringBuilder(data.Length * 3);<br />
foreach (byte b in data)<br />
sb.Append(Convert.ToString(b, 16).PadLeft(2, '0').PadRight(3, ' '));<br />
return sb.ToString().ToUpper();<br />
}<br />
|
|
|
|
|
I'm trying to create some linq expression manually.
At some stage I want to create an expression to concatenate 2 strings, I'm trying the following code:
using System.Linq.Expressions;
Expression e1, e2;
return Expression.Call(typeof(string), "Concat", new Type[] { typeof(string), typeof(string) }, e1, e2);
this call yield the following error:
System.InvaldOperationExpression
No method 'Concat' on type 'System.String' is compatible with the supplied arguments.
Well, well, I'm somewhat surprised...
what else could I try?
|
|
|
|
|
well, not sure in which forum this question fits.
is there any way or any tool which allows crystal reports to be converted to RDL file,
there are few website which claim to do that, but they provide the services and charge arround $25 per report etc..
Is this the last way i should do it,
i can redesign the entire thing (all reports) but sounds like lot of hectic work to me,
regards,
|
|
|
|
|
It's just converting from one file format to another. The trick is knowing the syntax of both and getting all the nuianses correct. It can be done, but it will take you longer, and cost more than $25.
only two letters away from being an asset
|
|
|
|