|
KamarBand wrote: string str = dr[5].ToString();
You should use the value inside the DataColumn, not the DataColumn itself (let me guess the column name is only 1 character).
|
|
|
|
|
Hi Leppie, thanx fory reply, i found the problem, one of the rows had a empty string, that's why i got the error.
|
|
|
|
|
KamarBand wrote: Bud i m getting a error: Index was outside the bounds of the array
on the 5e line : char second = str[1];
can anyone tell me why and what is the solution?
Yeah, you don't do any bounds checking on the string. In this case it's exactly one character long. If the string is empty, then it'll also crash in char first = str[0];
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi everybody
I hope I ask my question in the right place.
I want to access to source code of a WEBPAGE and change it.
For this, use mshtml.HTMLDocument2.
Usually I write source code with a StreameReader on Object IHTMLDocumetn2.
The output of StreamReader is perfect.
But after writing the output on IHTMLDocument2 something strange happens.
some quotation marks and backslashes disappear and the header changes.
Codes are as below:
string Content = MyStreamReader.ReadToEnd();
HTMLDocument MyDoc = new HTMLDocumentClass();
IHTMLDocument2 DocToUse = (IHTMLDocument2)MyDoc;
DocToUse.write(Content);
DocToUse.close();
Here the content and DocToUse.body.parentElement.outerHTML.ToString() should be excatly
the same but they are not. For better understanding please find the 2 screenshots.
Output of StreamReader: Click hier
Output of DocToUse.body.parentElement.outerHTML.ToString(): Click hier
Your kind reply will be much appripricate.
Best Regards.
ITS7
|
|
|
|
|
You should probably escape the quotations and backslashes. Experiment a bit. Other than that, it looks the same.
|
|
|
|
|
The problem is I can avoid qoutations and backslashes. for output I need standard xhtml. it's better to explain the problem in other way. In my project all relative urls must change to absolute ones.
Href belongs to anchor
-Src belongs to images
-Parameters belongs to flashmovie
-Src belongs to script
-Src belongs to link
.
.
.
The solution I know is using IHTMLDOCUMENT2 but as I told when I use it there occured some problems in Sourcecode, using REGEX may lead to some other problems because expanding sourcecodes are not always in XHTML format (for example missing "TAG and CLOSETAG or Qoutations arround properties etc."). In this case using REGEX is so complex.
Please let me know if you know other solutions as well as how I can use IHTMLDOUCMENT2 by Sourcecode which first I use without any changes
ITS7
|
|
|
|
|
Hi All,
I developed a Console application exe and its working fine in my local machine. I need to run the exe in remote machine using remote paths.
For example, if the remote server name is XYZ, the exe should be run on XYZ using remote paths like:
C:\>\\XYZ\C$\abc.exe ( on XYZ machine itself, actually this exe should be executed from vbscript with this path).
But its giving exception as following:
Exception : Request for the permission of type 'System.Data.SqlClient.SqlClientP
ermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c5
61934e089' failed.
Exception : System.Security.SecurityException: Request for the permission of typ
e 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Cult
ure=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMa
rk& stackMark, Boolean isPermSet)
at System.Security.PermissionSet.Demand()
at System.Data.Common.DbConnectionOptions.DemandPermission()
at System.Data.SqlClient.SqlConnection.PermissionDemand()
at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection o
uterConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection ou
terConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at BulkDataCopy.BulkDataCopy.Main(String[] args)
The action that failed was:
Demand
The type of the first permission that failed was:
System.Data.SqlClient.SqlClientPermission
The Zone of the assembly that failed was:
Intranet
Please let me know the solution if you find any...
Thank you,
Shah_Tech
|
|
|
|
|
shah_tech wrote: C:\>\\XYZ\C$\abc.exe
That will try run the remote executable on the local machine. That is not what you want. Google for some utility to remotely execute a program.
|
|
|
|
|
Hi Guys,
Pls i want my program to be the topmost window when it running. And it should not respond to command keys, like Alt+F4, Alt+Tab and Ctrl+Alt+Del, that allow for the user to abruptly leave, or exit the program.
How do i accomplish this?
Thanx.
He who goes for revenge must first dig two graves.
|
|
|
|
|
Creamboy wrote: And it should not respond to command keys, like Alt+F4, Alt+Tab and Ctrl+Alt+Del
Alt+F4: You probably can disable this in some keypress event handler of your form
Alt+Tab: You need to write a keyboard hook to disable this key combination
Ctrl+Alt+Del: No way. (unless you write some Gina dll replacement)
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Greeeg wrote: Alt+Tab: You need to write a keyboard hook to disable this key combination
Please, How do i do this?
He who goes for revenge must first dig two graves.
|
|
|
|
|
|
I have do this previously. You will need a global keyboard hook. Unfortunately I do not have the code anymore. Google should provide some answers, or maybe there are an article or 2 on CodeProject.
|
|
|
|
|
As to Alt-F4:that has been asked a couple of times already this year and this time I don't feel like looking for the other posts,
and I forget who here pointed me in the right direction, so...
private const System.Int32 SC_CLOSE = 0xF060 ;
private const System.Int32 MF_ENABLED = 0x0000 ;
private const System.Int32 MF_GRAYED = 0x0001 ;
[
System.Runtime.InteropServices.DllImportAttribute
(
"User32"
,
SetLastError=true
,
EntryPoint="GetSystemMenu"
)
]
private static extern System.IntPtr
API_GetSystemMenu
(
System.IntPtr hWnd
,
System.Boolean bRevert
) ;
[
System.Runtime.InteropServices.DllImportAttribute
(
"User32"
,
SetLastError=true
,
EntryPoint="EnableMenuItem"
)
]
private static extern System.Int32
API_EnableMenuItem
(
System.IntPtr hMenu
,
System.UInt32 uIDEnableItem
,
System.UInt32 uEnable
) ;
public static bool
DisableSystemMenuClose
(
System.Windows.Forms.Form Target
)
{
return ( API_EnableMenuItem
(
API_GetSystemMenu
(
Target.Handle
,
false
)
,
SC_CLOSE
,
MF_GRAYED
) != -1 ) ;
}
public static bool
EnableSystemMenuClose
(
System.Windows.Forms.Form Target
)
{
return ( API_EnableMenuItem
(
API_GetSystemMenu
(
Target.Handle
,
false
)
,
SC_CLOSE
,
MF_ENABLED
) != -1 ) ;
}
|
|
|
|
|
I created a report with CrystalReport2005 in C#2005, the report contains a subreport, and the master report links the subreport by a grouping field (That is master report and sub report is related by the grouping field, ) when creating the linkage between the master report and subreport, then automatically generating a parameter in the subreport , It works well when I preview in the CrystalReport environment , but when I execute in the C#2005,it ask me to pass the value for the parameter. I don't know how to handle it in the C#, Could you help me on it?
Many thanks in advanced!
|
|
|
|
|
who can help me on it?
Much appreciated!
|
|
|
|
|
Thanks all, I have worked it out.
|
|
|
|
|
hi all,
can anyone please help me...im trying to pass data from my master page to the page in my content place holder...im fairly new to c# so any help would be appretiated.
thanks in advance
living life on the flip side
|
|
|
|
|
|
thnaks...i will try asp.net but i thought that this would be the right forum coz im doing it in C# code behind
living life on the flip side
|
|
|
|
|
I am new to asp.net. Iam developing a webapplication in which i use a dynamically generated table control. I add rows into it, according to the data retrieved from the database. but when i try to resubmit the values in the table to the database, only the value in the last row is getting submitted. How can i sort out this problem??
|
|
|
|
|
I guess you're new to these forums too. Please ask ASP.NET questions in the ASP.NET forum, and there only.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hi all,
Suppose i have 5 text boxes among all , i want to edit first two with some special condition rest are can be edited when form load ... so while loading am setting some default value bit dont want to edit first two text box so what the property or code need to be applied here ..
textbox1.disabled could work but i dont have disabled property here ...
please help me ..
vikas da
|
|
|
|
|
Thank all who looked into my problem ...i got the solution textbox1.ReadOnly=true
vikas da
|
|
|
|
|
Use a maskedtextbox.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|