|
Sorry,
I have two datadridview (an empty dataGridView1 in Form1 and datagridview2 with data in Form2 ).
I have also "add" button on Form1 and "select" button on Form2 .
My wish is that if I click on "add" button in Form1 , I open Form2. When I select a line of my datagridview2 and when I click on the "select" button this line will appear in the dataGridView1 Form1 and disappear in datagridview2 (Form2) button.
Although I still click on "Add" I can do the same thing.
please help me
|
|
|
|
|
OK, so Form2 would be shown with ShowDialog. When the record is selected on it, Form2 code sets a public property that Form1 will read to pickup the record that was selected.
|
|
|
|
|
I want to fetch data from another web site . in (another website) there is a textbox where we submit a value than they return some data . i want to use same thing which is passes through my website . Added i can submit multi values on my textbox and fetch all the result of My textBox value from another site .
Sandeep Kumar Nishad
|
|
|
|
|
You have already posted this in QA and had replies - please do not post questions in multiple places, it duplicates work are wastes people's time.
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
|
|
|
|
|
You can do this. Not the easiest. Best is is look at the message that is sent by the page to request the data. Then you will get back the html for the web page. Will have to find some take in the page that you can search on, and then basically interpret the HTML to figure out what the response was.
|
|
|
|
|
Here is the method auto dial up without the login dialoge
public uint Connect(string EntryName, string UserName, string Password, out IntPtr RasConn)
{
uint retVal;
uint r=0;
RasConn=IntPtr.Zero;
byte[] bRASDIALPARAMS =new byte[1464];
fixed (byte* pAddr = bRASDIALPARAMS)
{
byte* pCurrent = pAddr;
Marshal.WriteInt32((IntPtr)pCurrent, bRASDIALPARAMS.Length);
pCurrent += 4;
foreach (byte b in Encoding.Unicode.GetBytes(EntryName))
{
Marshal.WriteByte((IntPtr)pCurrent, b);
pCurrent++;
}
pCurrent = pAddr + 0x192;
foreach (byte b in Encoding.Unicode.GetBytes(UserName))
{
Marshal.WriteByte((IntPtr)pCurrent, b);
pCurrent++;
}
pCurrent = pAddr + 0x394;
foreach (byte b in Encoding.Unicode.GetBytes(Password))
{
Marshal.WriteByte((IntPtr)pCurrent, b);
pCurrent++;
}
retVal = RAS.RasDial(IntPtr.Zero, IntPtr.Zero, (IntPtr)pAddr, 0, IntPtr.Zero, ref RasConn);
}
return retVal;
}
[DllImport("rasapi32.dll", CharSet = CharSet.Auto)]
public extern static uint RasDial(
IntPtr dialExtensions,
IntPtr phoneBookPath,
IntPtr rasDialParam,
uint NotifierType,
IntPtr notifier,
ref IntPtr pRasConn
);
It works fine on my xp machine,but move it to win7 the Connect() method returns erro 632,what's wrong in win7,does anyone have a clue?
|
|
|
|
|
|
Thank you!I solved my problem with DotRas in www.codeplex.com
|
|
|
|
|
Hi I have just started a little app to learn about web requests. Basically all I want to do is to login to hotmail via console and return the mail page. here is my code:
using System;
using System.Data;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Web;
using System.Text;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
var request = (HttpWebRequest)WebRequest.Create("http://login.live.com/");
String email = "test@hotmail.com";
String password = "password";
String postString = "login=" + email + "&passwd=" + password;
CookieCollection cookies = new CookieCollection();
string url = "http://login.live.com/";
request = WebRequest.Create(url) as HttpWebRequest;
request.Method = "GET";
request.Referer = url;
request.KeepAlive = true;
request.UserAgent = "User-Agent=Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0";
request.ContentType = "application/x-www-form-urlencoded";
request.CookieContainer = new CookieContainer();
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
cookies = response.Cookies;
Byte[] postData = Encoding.ASCII.GetBytes(postString);
url = "http://login.live.com/login.srf?wa=wsignin1.0&rpsnv=10&ct=1193552878&rver=4.5.2130.0&wp=MBI&wreply=http:%2F%2Fmail.live.com%2Fdefault.aspx&id=64855";
request = WebRequest.Create(url) as HttpWebRequest;
request.AllowAutoRedirect = true;
request.Method = "POST";
request.Referer = url;
request.KeepAlive = true;
request.UserAgent = "User-Agent=Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0";
request.ContentType = "application/x-www-form-urlencoded";
request.CookieContainer = new CookieContainer();
request.CookieContainer.Add(cookies);
request.ContentLength = postData.Length;
System.IO.Stream outputStream = request.GetRequestStream();
request.AllowAutoRedirect = true;
outputStream.Write(postData, 0, postData.Length);
outputStream.Close();
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.StatusDescription);
Console.WriteLine(response.Server);
Stream dataStream = response.GetResponseStream();
StreamReader reader = new System.IO.StreamReader(dataStream);
String responseFromServer = reader.ReadToEnd();
StreamWriter sw = new StreamWriter("test.html");
sw.Write(responseFromServer);
Console.Write(responseFromServer);
Console.ReadLine();
}
}
}
Problem is I keep getting this returned.
<html dir="ltr" lang="EN-US"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=Edge"/><base href="http://login.live.com/pp1450/"/><script type="text/javascript">var PROOF = {};PROOF.Type = {SQSA: 6, CSS: 5, DeviceId: 4, Email: 1, AltEmail: 2, SMS: 3, HIP: 8, Birthday: 9, TOTPAuthenticator: 10, Voice: -3};</script><noscript><meta http-equiv="Refresh" content="0; URL=http://login.live.com/jsDisabled.srf?mkt=EN-US&lc=1033"/>Microsoft account requires JavaScript to sign in. This web browser either does not support JavaScript, or scripts are being blocked.<br /><br />To find out whether your browser supports JavaScript, or to allow scripts, see the browser's online help.</noscript><title>Sign in to your Microsoft account</title><meta name="PageID" content="i5030"/><meta name="SiteID" content="10"/><meta name="ReqLC" content="1033"/><meta name="LocLC" content="1033"/><link rel="shortcut icon" href="http://auth.gfx.ms/14.500.21648.00/favicon.ico?v=2" />
Anyone able to provide some insight?
Thanks.
|
|
|
|
|
That response is not complete - there is not cloing /head tag, nor a cloasing /html.
Did you receive only that part, or is it some copy/paste problems with html tags?
|
|
|
|
|
sorry here is the full response:
<!DOCTYPE html>
<html dir="ltr" lang="EN-US"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=Edge"/><base href="http://login.live.com/pp1450/"/><script type="text/javascript">var PROOF = {};PROOF.Type = {SQSA: 6, CSS: 5, DeviceId: 4, Email: 1, AltEmail: 2, SMS: 3, HIP: 8, Birthday: 9, TOTPAuthenticator: 10, Voice: -3};</script><noscript><meta http-equiv="Refresh" content="0; URL=http://login.live.com/jsDisabled.srf?mkt=EN-US&lc=1033"/>Microsoft account requires JavaScript to sign in. This web browser either does not support JavaScript, or scripts are being blocked.<br /><br />To find out whether your browser supports JavaScript, or to allow scripts, see the browser's online help.</noscript><title>Sign in to your Microsoft account</title><meta name="PageID" content="i5030"/><meta name="SiteID" content="10"/><meta name="ReqLC" content="1033"/><meta name="LocLC" content="1033"/><link rel="shortcut icon" href="http://auth.gfx.ms/14.500.21648.00/favicon.ico?v=2" />
<link rel="stylesheet" title="R3CSS" type="text/css" href="http://auth.gfx.ms/14.500.21648.00/R3WinLive1033.css"/><style type="text/css">:root input[type=checkbox] + label, :root input[type=radio] + label{background-image: url(http://auth.gfx.ms/14.500.21648.00/controls.png), url(http://auth.gfx.ms/14.500.21648.00/controls.png), url(http://auth.gfx.ms/14.500.21648.00/controls.png);}
::-webkit-scrollbar-button{background-image: url(http://auth.gfx.ms/14.500.21648.00/controls.png);}
</style><style type="text/css">body{display:none;}</style><script type="text/javascript">if (top != self){ try{ top.location.replace(self.location.href);}catch (e){ }}else{ document.write(unescape('%3C%73') + 'tyle type="text/css">body{display:block !important;}</style>');}</script><noscript><style type="text/css">body{display:block !important;}</style></noscript><script type="text/javascript">var g_iSRSFailed=0,g_sSRSSuccess="";function _DY(a,f,b){var e=1,d=unescape('%3Cscript type="text/javascript" src="'),c=unescape('"%3E%3C/script%3E');if(g_sSRSSuccess.indexOf(a)!=-1)return;if(typeof window[a]=="undefined"){g_iSRSFailed=1;b<=e&&document.write(d+f+c)}else g_sSRSSuccess+=a+"|"+b+","}
var g_dtFirstByte=new Date();var g_objPageMode = null;</script><link rel="image_src" href="http://auth.gfx.ms/14.500.21648.00/Windows_Live_v_thumb.jpg" / >
<script type="text/javascript">var ServerData = {AQ:'',j:false,urlSwitch:'http://login.live.com/logout.srf?ru=https://accountservices.passport.net/default.srf%3fmkt%3dEN-US%26lc%3d1033%26id%3d10&bk=1367843853&lm=I',k:false,AR:'',l:true,sCBUpTxt1:'',AT:"Not associated with #~#fedbrandname#~#? You must <a href=\"#~#FederationRenameURL_LS#~#\" id=\"i1687\">rename the account</a>.",sCBUpTxt2:'',AU:"Help us make sure you\'re not a robot. <a href=\"javascript:DoHelp(\'pih\',\'\',\'1033\',\'pih,1033\',\'\',\'1450\',\'&format=b1\');\" id=\"i1577\">Why?</a>",n:false,p:true,AX:"Use the primary phone number you\'ve associated with your Microsoft account. <a href=\"javascript:DoHelp(\'\',\'\',\'1033\',\',1033\',\'\',\'1450\',\'&linktype=3\');\" id=\"idPaneHelpOTCInfoLink9\">Learn more</a>",q:0,r:3,s:0,sFedQS:'wa=wsignin1.0&wtrealm=uri:WindowsLiveID&wctx=bk%3D1367843853',t:0,u:1033,aa:'',ab:'http://login.live.com/gls.srf?urlID=WLFeedback&mkt=EN-US&vv=1450',B:['.hotmail.','.live.','.msn.'],ac:'http://login.live.com/gls.srf?urlID=MSNPrivacyStatement&mkt=EN-US&vv=1450',urlPost:'https://login.live.com/ppsecure/post.srf?bk=1367843853',html:[],D:2,Aa:{},str:[],Ab:{},F:true,af:'http://login.live.com/login.srf?vv=1450&mkt=EN-US&lc=1033',sErrTxt:'',Ac:'##li16####B##Hotmail##/B####BR##The smart way to do email - fast, easy and reliable##li8####B##Messenger##/B####BR##Stay in touch with the most important people in your life##li10####B##SkyDrive##/B####BR##Free, password-protected online storage',G:true,Ad:'',ah:'http://login.live.com/cookiesDisabled.srf?mkt=EN-US&lc=1033',H:false,I:false,oPost:{},urlFed:'',J:true,ak:'https://login.live.com/login.srf?vv=1450&mkt=EN-US&lc=1033&bk=1367843853',K:false,A3:'http://shared.live.com/~Live.SiteContent.Explore/~15.40.69/account/markets/EN-US/product.html?id=10&mkt=EN-US',A4:'',M:true,A5:'',A6:'',A7:'',A8:'',A9:'',R:0,Ao:'',Ap:'US',Aq:'bk=1367843853',U:1,V:0,aA:'https://account.live.com/security/LoginStage.aspx?lmif=1000&ru=http://login.live.com/login.srf%3Fvv%3D1450%26mkt%3DEN-US%26lc%3D1033&vv=1450&mkt=EN-US&lc=1033&cbid=0&id=10',Ar:'',aB:'http://login.live.com/gls.srf?urlID=WLHelpCentral&mkt=EN-US&vv=1450',aC:'http://login.live.com/gls.srf?urlID=WinLiveTermsOfUse&mkt=EN-US&vv=1450',At:"©2013 Microsoft",aD:'',Au:"#~#partnerdomain#~# does\'t use this service. Please sign in with a Microsoft account or create a new account. <a href=\"javascript:DoHelp(\'\',\'\',\'1033\',\',1033\',\'\',\'1450\',\'&linktype=2\');\" id=\"i1686\">Learn More</a>",AA:{},aE:'http://auth.gfx.ms/14.500.21648.00/',Av:"Sign in to .",AB:{'Logo':'','LogoAltText':'','LogoText':'','ShowWLHeader':true},AC:'sign up',aG:'http://go.microsoft.com/fwlink/?LinkID=254486',Ax:"A single-use code lets you sign in without entering your password. This helps protect your account when you\'re using someone else\'s PC. <a href=\"javascript:DoHelp(\'\',\'\',\'1033\',\',1033\',\'\',\'1450\',\'&linktype=3\');\" id=\"idPaneHelpOTCInfoLink9\">Learn more</a>",Ay:"Your session has timed out. To request a single use code, please <a href=\"javascript:NewOTCRequest()\">refresh the page</a>.",aI:'https://account.live.com/ResetPassword.aspx?wreply=http://login.live.com/login.srf%3fvv%3d1450%26mkt%3dEN-US%26lc%3d1033&id=10&uiflavor=web&mkt=EN-US&lc=1033&bk=1367843853',aJ:'https://signup.live.com/signup.aspx?bk=1367843853&ru=https://login.live.com/login.srf%3flc%3d1033%26mkt%3dEN-US&uiflavor=web&mkt=EN-US&lc=1033',sFTTag:'<input type="hidden" name="PPFT" id="i0327" value="ChMIciVl*xYdMuCisXfbVY67nDqkFlMRv0HcUfF1OC30iSTh!cliJdpPx!M0gpNHO8mromwdXXr67NuGgxqC!6T1lUNty4qeWPpa6p47bpa56ORtT!VgjRqaGtbx*I9XqApwoXhiGA3zr0keL71zdxo$"/>',aK:'https://login.live.com/login.srf?vv=1450&mkt=EN-US&lc=1033&bk=1367843853',a:['@hotmail.','@msn.','@live.','@yahoo.','@gmail.','@windowslive.','@sympatico.','@aol.','@163.','@freemail.','@gmx.','@comcast.','@web.','@libero.','@wanadoo.','@sbcglobal.','@example.','@tiscali.','@126.','@mail.','@q.','@xiaoi.','@hanmail.','@walla.','@free.','@ppauthz.com','@compaq.','@hotmail.co.','@messengeruser.','@passport.','@webtv.'],AH:'',d:0,AK:'',f:true,AN:'',g:false,AO:'',h:true,AP:'Passpor',i:false};</script><script type="text/javascript" src="http://auth.gfx.ms/14.500.21648.00/Login_Strings_JS1033.js"></script>
<script type="text/javascript" src="http://auth.gfx.ms/14.500.21648.00/Login_Core.js"></script>
<script type="text/javascript">_DY("__Login_Strings", "http://auth.gfx.ms/14.500.21648.00/Login_Strings_JS1033.js", 1);_DY("__Login_Core", "http://auth.gfx.ms/14.500
|
|
|
|
|
hiiiiiiiiiiiiiiiiiiiiii
in the ATL dll project there is one function with BYTE* Parameter.
STDMETHODIMP CMSDllServer::sum22(BYTE* aa,SHORT len)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
for(int i=1;i<len;i++)
{
aa[i]=i;
}
return S_OK;
}
in use during from this function in a windowes application c# doesnot exist no problem and array values returned to truth
byte[] Packet = new byte[5];
dllServer.sum22(ref Packet[0],5);
1,2,3,4,5
but
the same function in a webservice returned to only first index array and exist very big problem
byte[] Packet = new byte[5];
dllServer.sum22(ref Packet[0],5);
1,0,0,0,0
help me pleaseeeeeeeeeeeeeeeeeeeeeeeeeeeee
thanx
|
|
|
|
|
Check your definitions: the DLL is expecting a SHORT parameter, and you may be passing an integer. Since this is 32 bits, twice the length of a SHORT value, it is likely that the DLL is getting it as zero - in which case your Packet data will never be initialized by the function call.
BTW: Is your DLL correct?
The loop should start at zero, not one, shouldn't it?
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
|
|
|
|
|
MY dll is truth
AND dll ATL IS CORRECT IN WEBSERVICE
BUT DLL ATL IS TRUTH IN WINDOWES APPLICATION
|
|
|
|
|
1) DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalisation if you want to be taken seriously.
2) That makes no sense whatsoever!
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
|
|
|
|
|
I am Sorry
using all lower case is considered childish but this is wrong
you can testing the condition same and make in a project Atl and using in Webservice
you see result
in the ATL dll project there is one function with BYTE* Parameter.
STDMETHODIMP CMSDllServer::sum22(byte* aa)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
for(int i=1;i<5;i++)
{
aa[i]=i;
}
return S_OK;
}
in use during from this function in a windowes application c# doesnot exist no problem and array values returned to truth
byte[] Packet = new byte[5];
dllServer.sum22(ref Packet[0]);
1,2,3,4,5
but
the same function in a webservice returned to only first index array and exist very big problem
byte[] Packet = new byte[5];
dllServer.sum22(ref Packet[0]);
:zzz:
1,0,0,0,0
help me pleaseeeeeeeeeeeeeeeeeeeeeeeeeeeee
thanx
|
|
|
|
|
Dear Sir, i am calling web service from jquery in asp.net.It's working fine on local host but is not working on remote server.When i call directly web method on remote site then web method is called but there is problem how is to call it from client side? Please help me...
|
|
|
|
|
Where is your service hosted? You need to be able to access it through the client systems.
|
|
|
|
|
I know there is a way to tell if the usb device is in use. When one application fetches one usb device, the other application is unable to get the same device handle because it already "taken" by the 1st application.
right now, my two application are able to get the same usb devices.
any suggestion on how to prevent the 2nd application from detecting or open the usb device that is already taken by the other application?
|
|
|
|
|
Use a "Mutex".
Before "taking" the usb device, each application tries to create a Mutex.
If the Mutex is created, the device was free; else the "other" app is using the device (because "it" has already created the Mutex).
|
|
|
|
|
hmm I don't think Mutex would do. Tried to understand Mutex.
but what about with this method?
DeviceHandle = CreateFile(DevicePath, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, ref Security, OPEN_EXISTING, 0, 0);
Tried to understand it a bit too. If I use 0 in place of FILE_SHARE_READ | FILE_SHARE_WRITE, would this be a good idea?
|
|
|
|
|
A Mutex is simply a way to communicate a semaphor between processes.
If you're considering CreateFile, then you should go to the Windows API forum.
|
|
|
|
|
I'm building a vcf editor and there are approximately 4k contacts in the particular file I'm using.
I've gotten to contact 1000 in a little over 10 minutes, so I'm wondering what a faster way to go about parsing these would be?
The file is only 1.2mb and the function is below. Maybe the slow speed is in the gui update and not stream reader, not sure?
using (StreamReader reader = new StreamReader(filePath))
{
List<string> vcfFile = new List<string>();
string readLine;
while ((readLine = reader.ReadLine()) != null)
{
vcfFile.Add(readLine);
}
int count = 0;
foreach (string line in vcfFile)
{
if (line == "BEGIN:VCARD")
{
count = count + 1;
tbxOutput.Text += (count + ".) ").ToString();
}
tbxOutput.Text += line + System.Environment.NewLine;
if (line == "END:VCARD")
{
tbxOutput.Text += System.Environment.NewLine + System.Environment.NewLine;
}
Application.DoEvents();
}
}
|
|
|
|
|
I take it the UI is freezing while this runs in the foreground?
If you are not runnning this as a separate thread, run it as a background worker and update the textbox via a delegate.
Also get rid of the Application.DoEvents(); too as it is considered to be bad practise-> clickety[^].
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
Thanks for the reply.
I temporarily used the application.doevents() because I couldn't tell if it was doing anything.
I have since thrown this in, but it is still very very slow, especially after it gets past the first few hundred entries. The initial few hundred entries are at a speed I would expect.
I will try the workthread as well.
if (count % 50 == 0)
{
Application.DoEvents();
tbxOutput.SelectionStart = tbxOutput.Text.Length;
tbxOutput.ScrollToCaret();
tbxOutput.Refresh();
}
|
|
|
|
|