|
How can I convert byte[] to string. Plsz help me soon
Thanks all.
Papais
|
|
|
|
|
dungpapai wrote: Plsz help me soon
Sure, here[^] you go.
Cheers,
Vikram
"If a trend is truly global, then that trend ought to be visible across ANY subset of that data" - fat_boy
|
|
|
|
|
Hello,
I am kind of new with regular expressions. As far as I search over the internet I couldn't find a resonable solution. Suppose I have the following in a string:
Word0 word1 word2 word3 word4 word5 word6 word7 word8 word9
How can I capture the following?
word4 word5 word6 word7
I would like to catch the text between TWO boundries word4 and word7.
I`ve tried a lot of things none of them works.
Thank you very much for your help and have a great day.
Khoramdin
|
|
|
|
|
Hi!
Something similar to
.*(word4.*word7).* should work.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
I have a Bitmap reference "wavImg" inside of my custom UserControl. A method in this control, call it method "A" does the following:
wavImg = new Bitmap(x,y);
Graphics g = Graphics.FromImage(wavImage);
... drawing here
g.Dispose();
The OnPaint() method is overridden in the control and it checks if wavImg is null and if it's not, wavImg is drawn on the control.
Method A ends up being called by a GUI event handler, so it executes in the GUI thread. Likewise, OnPaint() is called from the GUI thread. The issue is that after "A" executes, the paint event happens, and OnPaint() is called, wavImg becomes null. The ONLY time wavImg is set to anything is in method A, the one assignment statement. Dispose() is NEVER called on wavImg.
How is it possible that wavImg becomes null?? There is exactly one reference to it in the class, so it shouldn't have been garbage collected. Any ideas are appreciated!
Thanks!
|
|
|
|
|
Hello,
maybe you should post more of your code.
I can't see the problem from here - only thing I can guess is that maybe you mistook
if (wavImg == null) with if (wavImg = null) ? (Not likely - I think there is even a warning for this kind of mistake).
Is the wavImg a static variable in the class? Try finding all references to wavImg, get a breakpoint to this line and try doing it the hard way (checking every step through the debuger).
By the way: the GC don't set ANY object-reference to null - it's looking for all objects in memory that aren't referenced at all at the moment and deletes them from memory! So if you've got an reference in code (reachable - i.e. not local variable or someting, the GC must find it from the root) the GC will do nothing at all to this object. And the GC will wait a long time before kicking in (that can be a pain if you forget some Dispose()
|
|
|
|
|
In the following example 1 I added rows to the DataSet
And I did not have any problem. However when I tried to add rows to a DataSet with more than one dimension I get the following error message at row 1 “Object reference not set to an instance of an object.”. I am unable to add the word new after equal sign. Does anyone know how to solve this problem.
Example 1
DataRow dr = dsI.EVar.NewRow();
dr["nRecordID"] = x;
dsI.EVar.Rows.Add(dr);
Example 2
DataRow dr = dsMI[x][1].EVar.NewRow();
dr["nRecordID"] = x;
dsMI[x][1].EVar.Rows.Add(dr);
Thanks in advance,
Michael
|
|
|
|
|
What is dsMI? Is it a DataSet[][] ? If yes, did you actually create an object for dsMI[x][1]? Creating a DataSet[][] does NOT create a 2-D array of DataSet objects, it only creates a 2-D array of *references* to DataSet objects, all of which are, by default, null .
Cheers,
Vikram
"If a trend is truly global, then that trend ought to be visible across ANY subset of that data" - fat_boy
|
|
|
|
|
dsMI is a DataSet and I did create the DataSet using
DataSet_MI[][] dsMI = new DataSet_MI[10][1].
Everything was done exactly as with dsI and it loaded dsI.
Michael
|
|
|
|
|
Vikram was right - looks like you don't initialise the object referenc - additionally you have a problem with dsMI[x][1] - you should get an ArgumentOutOfRange exception here! Watch out for the '1'.
Try using one more line:
dsMI[x][0] = new DataSet_MI();
just before the add.
|
|
|
|
|
Did you read my post? DataSet_MI[][] dsMI = new DataSet_MI[10][1] only creates a 2-D array of references, *all* of which are null , not a 2-D array of DataSet s. You have to do
for(int i = 0; i < 10; i++)
{
for(int j = 0; j < 5; j++)
{
dsMI[i][j] = new DataSet();
}
} to get a 2-D array of DataSet s. Replace 10 and 5 with your dimensions.
Cheers,
Vikram.
"If a trend is truly global, then that trend ought to be visible across ANY subset of that data" - fat_boy
|
|
|
|
|
hi.. may i know how to link expresssion blend to sql server 2005? i do the design of my project in blend.. and want to add the database in visual studio after i click on the .xaml.cs in blend .. but i found no wizard on Visual Studio..eg no dataset, no databinding wizards in VS toolbox..
how can i put in the database????? write code?
|
|
|
|
|
Hi
As a one of several projects in this semester at university i had to write socket application. So I wrote it. It works, well not flawlesly but I think not bad. In that app I'm using ZedGraph libraries to create graphs. It works of course. Ok, now is THE question: how to embed that dlls into output exe so I can use that embedded dlls as references to project to work everything right? I tried adding dll to a project and then in properties of dll file changing "Build Action" to "Embedded Resource". After building project output file was larger so i think that dlls are in exe. Unfortunately I can't in no way make a references from that files to project. Mmm, another stupid :P question: what is it for? I mean embedding something into exe when I can't use it? I've never used it so my knowledge is like "null" in that area.
Sorry for my bad English and thanks in advance for any word of help.
[EDIT]
I forgot to mention that I use VS2005. Sorry..
|
|
|
|
|
You can get a stream to an embedded resource, so you coulds use them for sounds or images etc.
And anyway, whats wrong with having the dll's outside the app?
My current favourite word is: Bauble!
-SK Genius
|
|
|
|
|
Currently, this code will return immediately after the process is
started. How can I modify it so that it will not return until the
process has stopped?
using (Process process = new Process())
{
process.StartInfo.FileName = @"C:\myprocess.exe";
process.StartInfo.Arguments = String.Format("-j {0}",
path);
process.Start();
}
/\ |_ E X E GG
|
|
|
|
|
eggie5 wrote: Currently, this code will return immediately after the process is
started. How can I modify it so that it will not return until the
process has stopped?
process.Start();
process.WaitForExit(); Share and enjoy.
Sean
|
|
|
|
|
Hi,
Am trying to create a custom DataGrid control the only pursues of this controls is to disable the HTML tags to be drawn in grid cells.
Am using VS.Net 2003 / C#
This is the controls class
<br />
using System;<br />
using System.Data;<br />
using System.Web;<br />
using System.Web.UI;<br />
using System.Web.UI.HtmlControls;<br />
using System.Web.UI.WebControls;<br />
using System.ComponentModel;<br />
using System.IO;<br />
<br />
namespace MyControl<br />
{<br />
[DefaultProperty("Text"), ToolboxData("<{0}:CustomDataGrid runat=server></{0}:CustomDataGrid>")]<br />
public class CustomDataGrid: DataGrid<br />
{<br />
<br />
public CustomDataGrid()<br />
{<br />
base.CopyBaseAttributes( this ); <br />
}<br />
<br />
<br />
protected override void OnItemDataBound(DataGridItemEventArgs e)<br />
{<br />
foreach( TableCell tblCell in e.Item.Cells)<br />
{<br />
tblCell.Text = tblCell.Text.Replace(">", ">").Replace("<", "<");<br />
}<br />
<br />
base.OnItemDataBound (e);<br />
}<br />
<br />
}<br />
}<br />
This is the HTML representation on the control on my ASPX Page
<br />
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="AspTest.WebForm1" %><br />
<%@ Register TagPrefix="cc1" Namespace="MyControl" Assembly=" MyControl" %><br />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ><br />
<HTML><br />
<HEAD><br />
<title>WebForm1</title><br />
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"><br />
<meta name="CODE_LANGUAGE" Content="C#"><br />
<meta name="vs_defaultClientScript" content="JavaScript"><br />
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"><br />
</HEAD><br />
<body><br />
<form id="Form1" method="post" runat="server"><br />
<cc1:CustomDataGrid id="CustomDataGrid1" runat="server" AllowHightLight="True" CssClass="TableStyle"<br />
GridLines="Vertical" AutoGenerateColumns="False"><br />
<FooterStyle Font-Size="0pt" ForeColor="White"></FooterStyle><br />
<AlternatingItemStyle CssClass="TableEvenStyle"></AlternatingItemStyle><br />
<ItemStyle CssClass="TableOddStyle"></ItemStyle><br />
<HeaderStyle CssClass="TableHeader"></HeaderStyle><br />
<Columns><br />
<asp:TemplateColumn HeaderText="dc"><br />
<ItemTemplate><br />
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.dc") %>' ID="Label1" NAME="Label1"><br />
</asp:Label><br />
</ItemTemplate><br />
</asp:TemplateColumn><br />
<asp:TemplateColumn HeaderText="dc1"><br />
<ItemTemplate><br />
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.dc1") %>' ID="Label2" NAME="Label2"><br />
</asp:Label><br />
</ItemTemplate><br />
</asp:TemplateColumn><br />
</Columns><br />
</cc1:CustomDataGrid><br />
</form><br />
</body><br />
</HTML><br />
The Code Behind
<br />
if (!IsPostBack )<br />
{<br />
CustomDataGrid1.DataSource = dtGetDataSoruce();<br />
CustomDataGrid1.DataBind();<br />
}<br />
<br />
private DataTable dtGetDataSoruce()<br />
{<br />
DataTable dt = new DataTable();<br />
<br />
DataColumn dc = new DataColumn("dc");<br />
DataColumn dc1 = new DataColumn("dc1");<br />
<br />
<br />
dt.Columns.Add(dc);<br />
dt.Columns.Add(dc1);<br />
<br />
DataRow dr = dt.NewRow();<br />
DataRow dr1 = dt.NewRow();<br />
DataRow dr2 = dt.NewRow();<br />
DataRow dr3 = dt.NewRow();<br />
<br />
dr["dc"] = "1";<br />
dr["dc1"] = "<a href='http://www.yahoo.com'>http://www.CodeProject.com</a>";<br />
<br />
dr1["dc"] = "2";<br />
dr1["dc1"] = "<input type='radio' runat='server' id='this.id' name='g'>";<br />
<br />
dr2["dc"] = "3";<br />
dr2["dc1"] = "Row Number 3";<br />
<br />
dr3["dc"] = "4";<br />
dr3["dc1"] = "Rows Number 4";<br />
<br />
dt.Rows.Add(dr);<br />
dt.Rows.Add(dr1);<br />
dt.Rows.Add(dr2);<br />
dt.Rows.Add(dr3);<br />
<br />
return dt;<br />
<br />
}<br />
<br />
You will note that the bound columns are a templates columns, the project is working properly in case of the grid columns is bound columns, but it’s not working in case of templates columns.
The second issue in the HTML design mode this error will apper
The active schema dose not support the element 'FooterStyle'
And 'asp:TemplateColumn'
And 'HeaderStyle'
And 'asp:TemplateColumn'
Etc. .
Why is the error for and why the controls dose not accepts template columns
Thanks in advance
Ala Qunaibi
|
|
|
|
|
Your ASPX page code doesn't look right. Have you posted it correctly?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="AspTest.WebForm1" %>
<%@ Register TagPrefix="cc1" Namespace="MyControl" Assembly="MyControl" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<LINK href="Style.css" type="text/css" rel="stylesheet">
<script language="javascript" src="JS/JScript1.js" type="text/javascript"></script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<P><cc1:customdatagrid id="CustomDataGrid1" runat="server" AllowHightLight="True" CssClass="TableStyle"
GridLines="Vertical" AutoGenerateColumns="False">
<FooterStyle Font-Size="0pt" ForeColor="White"></FooterStyle>
<AlternatingItemStyle CssClass="TableEvenStyle"></AlternatingItemStyle>
<ItemStyle CssClass="TableOddStyle"></ItemStyle>
<HeaderStyle CssClass="TableHeader"></HeaderStyle>
<Columns>
<asp:TemplateColumn HeaderText="dc">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.dc") %>' ID="Label1" NAME="Label1">
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="dc1">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.dc1") %>' ID="Label2" NAME="Label2">
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</cc1:customdatagrid></P>
</form>
</body>
</HTML>
|
|
|
|
|
Help
I want create an application that can't kill it from taskmanager or cmd?
I Want Learn
|
|
|
|
|
Learn Searcher wrote: I want create an application that can't kill it from taskmanager or cmd?
Why would you want to do that? Anyway, I doubt that it is possible.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Learn Searcher wrote: I want create an application that can't kill it from taskmanager or cmd?
Without it being part of the OS, then there's no way to make an application unkillable. It might be unkillable from the user level you're at, but it will be killable at some level.
Why would you want to do this anyway?
|
|
|
|
|
i hear that when OS want terminate an application send a kill signal to it.
now if handle this signal in our app then can restart our application in termination time of old application time.
And now HOW TO HANDLE THIS SIGNAL ?
I Want Learn
|
|
|
|
|
As far as I know... Windows will politely ask the application to close, and perhaps you can ignore that request, but if the application doesn't doesn't close in response to the request, then Windows will attempt to kill the process, and there is no way to stop that.
As for how to ignore the request, you can probably handle that in the FormClosing event handler.
|
|
|
|
|
hi.
I have a maskedTextBox which is going to accept date from user.
it's format is (00/00/0000) or (Short Date)
and i am using system.datetime.parse() to validate it.
by defult it accepts (mm/dd/yyyy)
how can I change it to (dd/mm/yyyy)?
Regards
|
|
|
|