|
i want to stored the image which i have in a picturebox to be stored in sqldatabase. and which datatype i should use in sql
|
|
|
|
|
|
You can place your own contol in the dropdownlist of a combobox, see here:
http://www.codeproject.com/KB/combobox/CustomComboBox.aspx
modified 27-May-14 5:28am.
|
|
|
|
|
If I want to grab a DataRowView I use:
DataRowView arrangement = (DataRowView)BindingContext[debtorDataSet, "Debtor.FK_PaymentArrangements_Debtor"].Current;
How can I get a DataRowView for the previous position without changing the position to do so please?
|
|
|
|
|
BindingContext[debtorDataSet, "Debtor.FK_PaymentArrangements_Debtor"].Position will give the current position. Get the table from debtorDataSet and take the row at position - 1.
|
|
|
|
|
Hi all,
Is is possible to add the result of two anonymous LINQ queries together (when the data is gathered from two different data sources), to form a variable that one foreach loop can iterate on. For example:
var query1 = from x in dataCollection
select new
{
name = x.Name,
surname = x.Surname
};
var query2 = from x in xmlCollection
select new
{
name = x.Name,
surname = x.Surname
};
foreach (var result in .....
Many thanks in advance,
Kind regards,
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
|
Ravi Mori wrote: You have to post this question in Linq Forum..
Your right ... sorry about that
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
If I open a web page (http://www.google.co.in/) on Mozilla firefox, How can I save to a specific Path (e.g., "C:\New Folder\WebPage.html")?
How to do this using c#
|
|
|
|
|
Check this link^
Might help you out..
|
|
|
|
|
hi,
i have many text boxes on my web page,
how can i get which text box is focused.
Thank You
|
|
|
|
|
foreach (Control c in Controls)
{
if (c.Focused)
{
MessageBox.Show(c.Text);
}
}
Remember to check if it is a TextBox, as buttons etc can also have the focus.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
i am receiving error-
Cannot convert method group "Focus" to non delegate type 'bool'
|
|
|
|
|
Have you had a look at the TexBox Class[^]?
Maybe you can find something there...
Kind regards,
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
Something like this should work:
foreach (Control ctrl in Page.Controls)
{
if (ctrl is TextBox && ctrl.Focused)
{
((TextBox)(ctrl)).Text = "FOUND YOU!!";
}
}
Kind regards,
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
Controls have an event that's triggered when they get focus, so you could just hook into this on every control, and store the last focused item yourself
|
|
|
|
|
You would probably get better responses on the Web Development Forum, but for what it's worth in Windows Forms there is the ActiveControl property. Is that also available For ASP?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I want to know how can I retrieve the GUID stored in the Assembly Information in the project properties using C#?
|
|
|
|
|
using System.Reflection;
Assembly asm = Assembly.GetExecutingAssembly();
Console.WriteLine(asm.GetType().GUID.ToString());
Cheers...
|
|
|
|
|
Unfortunately, the previous solution is highly unlikely to work. However, you can find a small snippet which shows the method (and some code) here[^]
|
|
|
|
|
I want to extract frames from video files without playing them. I used the GetCurrentImage of IBasicVideo2 to extract frames of videos as thumbnails of them. I Successfully extracted frames from video files of the format of WMV, AVI, DAT, ASF except MPG and VOB. When I extract frames of MPG and VOB files, It returns black frames.(The frames extracted are Successfully saved as bmp image files on my pc. however, they are all black frames.) Why??
Here is my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Runtime.InteropServices;
using System.Drawing;
using System.Drawing.Imaging;
using DShowNet;
using QuartzTypeLib;
namespace test2
{
/// <summary>
/// Window1.xaml 的交互逻辑
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
string videoFileName = "d:\\aaaa\\《OVER IT》MV.MPG";
string bitmapFileName = "d:\\《OVER IT》MV.MPG.bmp";
GetThumbnail(videoFileName, bitmapFileName);
}
private bool GetThumbnail(string videoFileName, string bitmapFileName)
{
FilgraphManagerClass filgraph = new FilgraphManagerClass();
try
{
filgraph.RenderFile(videoFileName);
filgraph.CurrentPosition = filgraph.Duration / 2;
int width = filgraph.SourceWidth;
int height = filgraph.SourceHeight;
int pBufferSize = 0;
DShowNet.IBasicVideo2 video = (DShowNet.IBasicVideo2)filgraph;
video.GetCurrentImage(ref pBufferSize, IntPtr.Zero);
IntPtr pDIBImage = Marshal.AllocHGlobal(pBufferSize);
video.GetCurrentImage(ref pBufferSize, pDIBImage);
int stride = -4 * width;
System.Drawing.Imaging.PixelFormat format = System.Drawing.Imaging.PixelFormat.Format32bppRgb;
IntPtr scan0 = (IntPtr)(((int)pDIBImage) + (pBufferSize - (4 * width)));
Bitmap bmp = new Bitmap(width, height, stride, format, scan0);
bmp.Save(bitmapFileName);
Marshal.FreeHGlobal(pDIBImage);
}
catch
{
return false;
}
while (Marshal.ReleaseComObject(filgraph) > 0) ;
return true;
}
}
}
BR,
Smilefishcc
|
|
|
|
|
Hello All ,
I have developed my project . Now i want to Automate Test Framework . Ideally we should write Test cases as sooner as we writ the code .
But now i have develeoped all my Layers UI,BLL, DAL.
Now my question is In what order i should write the test cases I mean first i should for the dal then bll and then UI .
Or from top to bottom like UI--->BLL---->DAL
which approcah will be better Suggest .
Any pointers to above will be higly helpful to me
Regards,
Phani
|
|
|
|
|
This is nothing to do with C#; please post to the Test forum.
|
|
|
|
|
Usually you don't write unit tests for DAL. You should write tests for business layer. If it involves calls to DAL, it should be mocked. IMO, writing unit tests after completing the project is very tough. Your classes might not be test friendly and refactoring will be a pain.
|
|
|
|
|
Hi, I am trying to connect to Sybase SQLAnyWhere DB from C# using ODBC Data Connection.
I am getting the below error.
"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Can anyone tell me the reason for that ?
Error Report :
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.Data.Common.UnsafeNativeMethods.SQLExecDirectW(OdbcStatementHandle StatementHandle, String StatementText, Int32 TextLength)
at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader, Object[] methodArguments, SQL_API odbcApiMethod)
at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader)
at System.Data.Odbc.OdbcCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Odbc.OdbcCommand.ExecuteReader()
I have a list of command strings.
I am exceuting the following commands in for loop.
foreach (string str in stringlist)
{
OdbcCommand defineTankCMD = Conn.CreateCommand();
defineTankCMD.CommandText = str;
OdbcDataReader defineTankReader = defineTankCMD.ExecuteReader();
defineTankReader.Close();
}
Is it OK. some times it is working fine and some times it was giving error.
|
|
|
|