|
I need to find an integer element in this 2d list and modify it.
|
|
|
|
|
It's a list like this: List<List<int>>
|
|
|
|
|
Not tested:
list is List<List<int>>
foreach(List<int> list2 in list)
{
int index = list2.IndexOf(value);
if(index != -1)
{
list2[index] = newvalue;
break;
}
}
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Loop through the outer list, for every list loop through the inner list and look for the item.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi there, I just installed Microsoft Visual C# 2008 Express edition and after publishing to local disk, when I run the setup.exe file it spits out a blank message box and blank form with the setup icon on it. Has anyone experienced this before? Where could I find out more do you think?
Thanks for the help
Linden
|
|
|
|
|
Does your machine meet the minimum hardware requirements? I dunno what they are for the Express Editions - I installed the Professional edition.
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson
|
|
|
|
|
How would that make a difference? It's not visual studio that won't install it's on of the applications that I compiled with Visual studio. I imported the project from 2005 but when I published it in 2008 the setup didn't work.
My dilemma
|
|
|
|
|
|
HI,
can i put for Example :3 ComboBox in a specific cell
THNKS
kobkob
|
|
|
|
|
kobibi wrote: Example :3 ComboBox
What?
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson
|
|
|
|
|
HI,
Q1 :
can i build a Row in a data set that will have Multiline
For Example :3 ComboBox Cells in a specific cell
?
Q2 :
can i add any kind of Controls to the Data Set
For Example : myControl - somthing i created
?
if anyone can HLEP
THNKS
kobkob
|
|
|
|
|
Why on earth would you want to add controls to datasets? Use datasets for CRUD operations & create controls to display that data.
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson
|
|
|
|
|
Sorry , i meant DataGridView
kobkob
|
|
|
|
|
Since those appear to be one and the same question, the answer is yes, you can.
Take a look at this example:
http://msdn2.microsoft.com/en-us/library/aa730881(VS.80).aspx[^]
Everywhere it uses the numeric up down, you would replace with your control. Note, if you want 3 combo boxes in one cell, you're going to have to create a custom control that contains 3 combo boxes, and write all of the data binding code yourself.
The early bird who catches the worm works for someone who comes in late and owns the worm farm. -- Travis McGee
|
|
|
|
|
THNKS man
So Simple
THNKS Alot
kobkob
|
|
|
|
|
i havetwo PCs one with resolution 800*600 and second Pc with resolution 1024*768 i have made a windowform where i place a groupbox full of controls the problem is this that when i run that application on 800*600 pixels PC the controls are displayed as the were placed on the form but when i run it on the PC with 1024*768 resolution the controls are squeezed on the form leavingl ot of space empty on the form how to over come this problem
sas
|
|
|
|
|
Set the dock and anchor properties of your controls so that it sizes properly
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Dear All,
Am having Nearly 470 Text files. I want to do a text replacement in all these files. There are 60-80 replacements in each page. here is sample contents of one of the file
<input type=hidden name="item" value="Kansas State Backpack"><br />
<input type=hidden name="Price" value="39.99"><br />
<input type=hidden name="PartNo" value="XXX-XX"><br />
<input type=submit value="Add to Cart"><br />
</form><br />
<p><a href="javascript:popUp('../images/Backpack/158-62.jpg')"><br />
<br />
<input type=hidden name="item" value="Oregon Backpack"><br />
<input type=hidden name="Price" value="39.99"><br />
<input type=hidden name="PartNo" value="XXX-XX"><br />
<input type=submit value="Add to Cart"><br />
</form><br />
<p><A HREF="javascript:popUp('../images/Backpack/194-62.jpg')"><br />
<br />
<input type=hidden name="item" value="Arizona Backpack"><br />
<input type=hidden name="Price" value="39.99"><br />
<input type=hidden name="PartNo" value="XXX-XX"><br />
<input type=submit value="Add to Cart"><br />
</form> <br />
<p><A HREF="javascript:popUp('../images/Backpack/106-62.jpg')">
Here for value XXX-XX it must be replaced with the .JPG file name which comes below.
I have Created a Desktop Application in C# to do this. its getting converted but the alignment changes happens for files.
Am doing it this way
1) Am Opening Text File
private const string FILE_TAG = "[FILE]";<br />
private const string FILENAME_TAG = "[NAME]";<br />
private const string FILE_FILTER = "Text files (*.txt)|*.txt|All files (*.*)|*.*";<br />
<br />
private bool m_bIncludeRelativePath = false;<br />
private bool m_bRecurseSubDirs = false;<br />
<br />
private string m_sFilePath = string.Empty;<br />
private string m_sSourcePath = string.Empty;<br />
private string m_sInputTemplate = string.Empty;<br />
string sPingPath = string.Empty;<br />
public TEXT_REPLACE()<br />
{<br />
InitializeComponent();<br />
}<br />
private string GetOpenFilePath()<br />
{<br />
string sFilePath = string.Empty;<br />
<br />
OpenFileDialog openFile = new OpenFileDialog();<br />
openFile.Title = "Open File";<br />
openFile.Filter = FILE_FILTER;<br />
<br />
if (openFile.ShowDialog() == DialogResult.OK)<br />
{<br />
sFilePath = openFile.FileName;<br />
sPingPath = openFile.FileName;<br />
}<br />
<br />
<br />
return sFilePath;<br />
}<br />
private string LoadFile(string sFilePath)<br />
{<br />
FileStream file = null;<br />
StreamReader sr = null;<br />
string sContents = string.Empty;<br />
try<br />
{<br />
if (sFilePath.Trim() == string.Empty)<br />
{<br />
sFilePath = GetOpenFilePath();<br />
if (sFilePath.Trim() == string.Empty)<br />
{<br />
return string.Empty;<br />
}<br />
<br />
}<br />
<br />
FileInfo fsi = new FileInfo(sFilePath);<br />
<br />
string sFullPath = fsi.FullName;<br />
<br />
file = new FileStream(sFullPath, FileMode.OpenOrCreate, FileAccess.Read);<br />
<br />
sr = new StreamReader(file);<br />
<br />
string s = sr.ReadToEnd();<br />
sContents = s;<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show("LoadFile() Error: " + ex.Message, "LoadFile Error", MessageBoxButtons.OK, MessageBoxIcon.Error);<br />
}<br />
finally<br />
{<br />
if (sr != null)<br />
sr.Close();<br />
<br />
if (file != null)<br />
file.Close();<br />
}<br />
<br />
return sContents;<br />
}<br />
private void btnOpenFile_Click(object sender, EventArgs e)<br />
{<br />
<br />
Convert(GetOpenFilePath());<br />
<br />
<br />
}
2) Converting It and putting to a richtextbox
public void Convert(string Pathstring)<br />
{<br />
bool change = false;<br />
<br />
StreamReader re = File.OpenText(Pathstring);<br />
string test = "";<br />
string input = null;<br />
while ((input = re.ReadLine()) != null)<br />
{<br />
<br />
<br />
if (input.Contains("XXX-XX"))<br />
{<br />
change = true;<br />
<br />
}<br />
if (change == true)<br />
{<br />
if (input.Contains(".jpg"))<br />
{<br />
if (test.Contains("XXX-XX"))<br />
{<br />
test = test.Replace("XXX-XX", GetFilename((input)));<br />
}<br />
}<br />
}<br />
<br />
test += input+"\r\n";<br />
}<br />
re.Close();<br />
richTextBox1.Text = test;<br />
}<br />
public string GetFilename(string line)<br />
{<br />
string filename="";<br />
string[] Arr = line.Split('/');<br />
for (int i = 0; i <= Arr.Length - 1; i++)<br />
{<br />
if (Arr[i].Contains(".jpg"))<br />
{<br />
filename = Arr[i].ToString();<br />
}<br />
}<br />
filename=filename.Substring(0,filename.IndexOf(".jpg"));<br />
return filename;<br />
}
3 Saving it
private string GetSaveFilePath(string sInitialPath, string sDefaultFileName)<br />
{<br />
string sFilePath = string.Empty;<br />
<br />
SaveFileDialog saveFile = new SaveFileDialog();<br />
saveFile.Title = "Save File";<br />
saveFile.Filter = FILE_FILTER;<br />
<br />
if ((sInitialPath != null) && (Directory.Exists(sInitialPath) == true))<br />
{<br />
saveFile.InitialDirectory = sInitialPath;<br />
}<br />
<br />
if ((sDefaultFileName != null) && (sDefaultFileName.Length > 0))<br />
{<br />
saveFile.FileName = sDefaultFileName;<br />
}<br />
<br />
if (saveFile.ShowDialog() == DialogResult.OK)<br />
{<br />
sFilePath = saveFile.FileName;<br />
}<br />
<br />
return sFilePath;<br />
}<br />
private void btnSaveFile_Click(object sender, EventArgs e)<br />
{<br />
TextBox txtActive = GetActiveTabTextBox();<br />
<br />
SaveFile(sPingPath, richTextBox1.Text);<br />
<br />
}
So right now while saving the file its alignment is getting changed like this
<input type=hidden name="item" value="Kansas State Backpack"><input type=hidden name="Price" value="39.99"><input type=hidden name="PartNo" value="XXX-XX"><br />
can someone please help me out to sort this issue.
Thnaks in advance
-- modified at 5:25 Sunday 7th October, 2007
|
|
|
|
|
I'm not sure I follow, but I'd use File.ReadAllText and File.WriteAllText ( or ReadAllLines/WriteAllLines ) to read/write the file. And if the changes are known, I'd just use string.Replace to do them.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
IMHO it's a single line of code:
File.WriteAllText(file, File.ReadAllText(file).Replace("XXX-XX", "(the .jpg)"));
A full program:
using System.IO;
namespace BLA {
static class Program{
static void Main(string[] files)
{
foreach(string file in files)
File.WriteAllText(file, File.ReadAllText(file).Replace("XXX-XX", "(the .jpg)"));
}}}
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
It wont work since the.jpg has to be taken dynamically, its writing same file name for all XXX-XX
|
|
|
|
|
i have made a small program i want to make a setupo f that i had also created login id so how to create a setup
sas
|
|
|
|
|
File > New Project > Setup & Deployment Project
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson
|
|
|
|
|
|
hi all,
in my .net application i have my ui in one server and business logic in one server and database from another server,
how can i establish communicatin between these 3 servers
if i want to get dabase info into code behind how can i access the data
Could some one help me
Thanks
sri
|
|
|
|