<html dir="LTR">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" />
<title>P4Form Class</title>
<xml>
</xml>
<link rel="stylesheet" type="text/css" href="MSDN.css" />
</head>
<body id="bodyID" class="dtBODY">
<div id="nsbanner"> <div id="bannerrow1">
<table class="bannerparthead" cellspacing="0" id="Table1">
<tr id="hdr">
<td class="runninghead">Perforce API for the .Net CLR</td>
<td class="product"><img alt="P4.Net" src="p4net.GIF" /></td>
</tr>
</table>
</div>
<div id="TitleRow">
<h1 class="dtH1">P4Form Class</h1>
</div>
</div>
<div id="nstext">
<p> Represents a Perforce 'Form' object. </p>
<p>For a list of all members of this type, see <a href="P4API.P4FormMembers.html">P4Form Members</a>.</p>
<p>
<a href="ms-help://MS.NETFrameworkSDKv1.1/cpref/html/frlrfSystemObjectClassTopic.htm">System.Object</a>
<br /><a href="P4API.P4Record.html">P4API.P4Record</a><br /><b>P4API.P4Form</b></p>
<div class="syntax">
<span class="lang">[VisualBasic]</span>
<br />PublicClassP4Form<div>Inherits<a href="P4API.P4Record.html">P4Record</a></div></div>
<div class="syntax">
<span class="lang">[C#]</span>
<div>publicclassP4Form<b> : <a href="P4API.P4Record.html">P4Record</a></b></div>
</div>
<h4 class="dtH4">Remarks</h4>
<p> Forms are the things that pop-up in an editor when run from a command line. In P4.Net (and most other Perforce APIs), you do not need to parse/format the text manually. Instead, you can get/set the fields using the Fields and ArrayFields collections. <P>The following is a list of common form commands:</P>
<list>
<li>client</li>
<li>branch</li>
<li>label</li>
<li>job</li>
<li>user</li>
<li>group</li>
<li>protect</li>
<li>triggers</li>
<li>branch</li>
</list>
<P> When fetching or saving a form, <B>do not use the '-o' and '-i' flags</B>. P4.Net will automatically include them. </P>
</p>
<h4 class="dtH4">Example</h4>
<p> The following example updates the current client. It changes the client root, and adds a line to the view. <pre class="code" language="C#" escaped="true"> P4Connection p4 = new P4Connection();
p4.Connect();
P4Form MyClient = p4.Fetch_Form("client");
//Change the root and properties
MyClient["Root"] = @"C:\p4\P4.NetClient";
MyClient["Description"] = "Created from P4.Net!";
//Fetch the clientName (for use later in building the view spec).
string clientName = MyClient["Client"];
// Build a new array, that has one more element than the current view
string[] NewView = new string[MyClient.ArrayFields["View"].Length + 1];
// Copy the existing view lines to the new array
MyClient.ArrayFields["View"].CopyTo(NewView,0);
// Set the new view line
NewView[NewView.Length - 1] = string.Format("//depot/newpath/... //{0}/newpath/...", clientName);
MyClient.ArrayFields["View"] = NewView;
// Save the form
P4UnParsedRecordSet MyResult = p4.Save_Form(MyClient);
p4.Disconnect();
</pre>
</p>
<h4 class="dtH4">Requirements</h4>
<p>
<b>Namespace: </b>
<a href="P4API.html">P4API</a>
</p>
<p>
<b>Assembly: </b>p4api (in p4api.dll)
</p>
<h4 class="dtH4">See Also</h4>
<p>
<a href="P4API.P4FormMembers.html">P4Form Members</a> | <a href="P4API.html">P4API Namespace</a></p>
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e" viewastext="true" style="display: none;">
<param name="Keyword" value="P4Form class, about P4Form class">
</param>
</object>
<hr />
<div id="footer">
<p>
<a href="Copyright.html">Copyright 2006 Shawn Hladky</a>
</p>
<p>
</p>
</div>
</div>
</body>
</html>