Click here to Skip to main content
       

C#

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page  Show 
GeneralRe: Question about split [modified]memberPIEBALDconsult27 Dec '12 - 11:03 
Not if he wants the name to stay whole (which I assume to be the case). That [what Sledge suggests] seems like a bad idea in general.

modified 27 Dec '12 - 18:37.

GeneralRe: Question about splitmemberS Douglas27 Dec '12 - 11:29 
Your assumption is correct. Needed the whole name. To get it done, I changed the delimiter in the data from a comma to a tilde. It worked users are happy for the moment.
 
(Edit) Part of the conversion process is breaking the name apart into first name last name

Common sense is admitting there is cause and effect and that you can exert some control over what you understand.


GeneralRe: Question about splitmemberSledgeHammer0127 Dec '12 - 13:34 
I don't get it. You have a string as "Last Name, First Name" and you want Last Name, First Name without the quotes? Then just strip off the quotes. There is no need to use the split function. Since you want to break the name apart, my solution is actually correct. Remove the quotes, then split based on the comma.
GeneralRe: Question about split [modified]memberPIEBALDconsult27 Dec '12 - 13:59 
No, that's just one of the fields. Check out some troublesome data:
 
id,name,location,phone
1,"Smith, John","Anytown, USA",123-4567
2,William "The Refrigerator" Perry,The Gridiron,000-0000
3,Madonna,"Los Feliz, Los Angeles, CA",555-5555
 
Not to say that the OP has such problems with which to deal, but some do.

modified 27 Dec '12 - 22:19.

GeneralRe: Question about splitmemberSledgeHammer0127 Dec '12 - 14:29 
I don't recall seeing that in the original post. I went back and re-read it, and if that is what the OP had intended, its a very poorly worded question Smile | :) . In this case, I'd:
 
string[] parts = Split(',')
 
foreach (string in parts)
Replace("\"", "");
 
Personally, parts 1 and 2 need special comma handling and parts 0 and 3 don't.
 
If I wanted to get sophisticated, I believe you can use datasets to parse something like that for you, but I'd just do what I said above... split on the commas, strip off the quotes and then process the 4 fields.
GeneralRe: Question about splitmemberPIEBALDconsult27 Dec '12 - 15:10 
William "The Refrigerator" Perry and Madonna say that's a bad idea.
 
Without more knowledge of the data, the only proper way to handle this is to split on the delimiters while honoring the quotes.
 
Replace is rarely an appropriate tool.
GeneralRe: Question about splitmemberPIEBALDconsult27 Dec '12 - 16:14 
SledgeHammer01 wrote:
its a very poorly worded question Smile | :)

 
Those are some of the lines I've become better at reading between. If it were that simple, the question wouldn't have been asked (by this particular asker).
GeneralRe: Question about splitmemberSledgeHammer0127 Dec '12 - 17:24 
Oh, NM... I see his issue now.
GeneralRe: Question about splitmemberApril Fans27 Dec '12 - 14:14 
This is actually what I would've done too - it's seems simpler.
But then there are also multiple fields involved.
Projects I'm working on:
 
Email Marketing

QuestionDebugging C# application using WinDbg 6.12.0002.633 [modified]memberSharath C V27 Dec '12 - 0:20 
Is it possible to debug into C# source code using WinDbg 6.12.0002.633?
 
I read on the internet that this is not possible with 6.12.0002.633. On 32 bit Win7, I am able to set breakpoint into C# source file, but the breakpoint does not showup in red.
 
One of the link says that it is possible to debug into C# source code only with WinDbg 6.7.05.0.
 
I did not download .Net framework source code.
 
I need to debug on a 64 bit Win 7 OS. Did not try yet on Win 7 64 bit as I was not able to debug into C# code on 32 bit version itself using WinDbg.
 
Thanks,
Sharath

modified 28 Dec '12 - 0:43.

QuestionHOW TO ADD LINK TAG IN CODE OF ASPX.CS PAGE ALONG WITH TAB TEXT TO OPEN LINK.membersaurabh pintu goel26 Dec '12 - 19:51 
I hv written following code to show text on tab click in google map now alone with text in pop up window i want to give link as well how to give that?
 
code is....
GooglePoint GP4= new GooglePoint();
GP4.ID = "4";
GP4.Latitude = 28.496193;
GP4.Longitude = 77.096595;
GP4.InfoHTML = "This is pointing to Building 6 Tower C NIL Labs Ground Floor";
//HtmlAnchor GP5= default(HtmlAnchor);
//GP5.HRef = "http://www.google.com/";
//how to give link to open web page along with " this is pointing to buildin...." text shown in above code.
AnswerRe: HOW TO ADD LINK TAG IN CODE OF ASPX.CS PAGE ALONG WITH TAB TEXT TO OPEN LINK.mvpOriginalGriff27 Dec '12 - 4:12 
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.
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.

Questionhow to add link tag with text in aspx.cs pagemembersaurabh pintu goel26 Dec '12 - 19:44 
i want to add link to my tab pop up to open any web page on click of it as i have to use HTMLanchor tag how to use it in following code to give link with text
 

GooglePoint GP4= new GooglePoint();
GP4.ID = "4";
GP4.Latitude = 28.496193;
GP4.Longitude = 77.096595;
GP4.InfoHTML = "This is pointing to Building 6 Tower C NIL Labs Ground Floor";//here with this tab i want to give a link like "www.google.com",this is aspx.cs page code
//HtmlAnchor GP5= default(HtmlAnchor);
//GP5.HRef = "http://www.nil-labs.com/";
Question.net web applicationmembervr99999999926 Dec '12 - 18:28 
Is it possible to implement tcp server inside .net web application
AnswerRe: .net web applicationmvpDave Kreskowiak27 Dec '12 - 1:33 
Yes, but why would you want to?
 
It's better off as it's own seperate application.

GeneralRe: .net web applicationmembervr99999999927 Dec '12 - 2:18 
Actually i have devices(client) which communicate through tcp with server(C# desktop app).What i want is to access the server and control the devices(client) through web.
GeneralRe: .net web applicationmvpDave Kreskowiak27 Dec '12 - 2:21 
OK??? You're still going to have to write a seperate server application. It's not a good idea to implement a TCP server inside a web app.

GeneralRe: .net web applicationmembervr99999999927 Dec '12 - 18:21 
thanks for the suggestion Dave .
AnswerRe: .net web applicationmemberApril Fans27 Dec '12 - 3:46 
I suppose you could. Personally, I have not done it. But from what I gather based on the above - it probably would not be beneficial.
Projects I'm working on:
 
Live Support

GeneralRe: .net web applicationmembervr99999999927 Dec '12 - 18:23 
thanks, now i ' m planning to write a separate web app.
QuestionCollect remote computer infomemberMember 970663326 Dec '12 - 12:17 
As in below artical i had been try to get info from another computer;
Collecting Remote System Information With WMI[^]
 
However, i had created class Systeminfo and followed the steps infact i had embed the provided source and run my script but received error (Object reference not set to an instance of an object.)
AnswerRe: Collect remote computer infomemberPIEBALDconsult26 Dec '12 - 14:33 
Huh, too bad. Sure wish we could see your code so we could help.
AnswerRe: Collect remote computer infomemberMember 970663326 Dec '12 - 15:37 
here is my script;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Globalization;
 
namespace Computer_system
{
 

    public partial class Form1 : Form
    {
        private RemoteSysInformation.SystemInformation sysinfo;
 
        public Form1()
        {
            InitializeComponent();
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
            if (sysinfo.Get("textBox4.text") != 0)
            {
                MessageBox.Show("Error getting system information.", "System Information");
            }
            else
            {
 

 
                textBox3.Text = ("" + Computer_system.win32_computer_system.GetDomain());
                textBox2.Text = ("" + Computer_system.win32_computer_system.GetUserName());
                textBox1.Text = ("" + Computer_system.win32_computer_system.GetPSComputerName());
                textBox5.Text = ("" + Computer_system.win32_computer_system.GetManufacturer());
                textBox6.Text = ("" + Computer_system.win32_computer_system.GetModel());
                listBox1.Text = ("" + Computer_system.win32_printer.GetName());
 
            }
        }
 
        private void button4_Click(object sender, EventArgs e)
        {
 
            // Execute command with arguments in Dos command line
            Process.Start("Cmd.exe", @"/C mstsc.exe /v:");
            //  /C parameter means exiting Cmd.exe after executing command

        }
 
        private void button2_Click(object sender, EventArgs e)
        {
            // Execute command with arguments in Dos command line
            Process.Start("Cmd.exe", @"/C RC.exe 1");
            //  /C parameter means exiting Cmd.exe after executing command
        }
 
        private void button3_Click(object sender, EventArgs e)
        {
            // Execute command with arguments in Dos command line
            Process.Start("Cmd.exe", @"/C MSRA.exe /OfferRA");
            //  /C parameter means exiting Cmd.exe after executing command
        }
 
        private void Form1_Load(object sender, EventArgs e)
        {
 
        }
 

    }
}

GeneralRe: Collect remote computer infomemberPIEBALDconsult26 Dec '12 - 15:42 
Among other things, it appears you don't instantiate the sysinfo.
 
Run it in the debugger, step through, and see where (else) the problem is.
 

 
And what's with the "" + ? Confused | :confused:
GeneralRe: Collect remote computer infomemberMember 970663326 Dec '12 - 15:44 
i do run debug and received below
 
Object reference not set to an instance of an object
GeneralRe: Collect remote computer infomemberPIEBALDconsult26 Dec '12 - 15:55 
Yes, but where? Which statement caused it?
GeneralRe: Collect remote computer infomemberMember 970663326 Dec '12 - 15:55 
if (sysinfo.Get("textBox4.text") != 0)
GeneralRe: Collect remote computer infomemberPIEBALDconsult26 Dec '12 - 15:57 
Just as I thought. You need to initialize sysinfo.
GeneralRe: Collect remote computer infomemberMember 970663326 Dec '12 - 15:58 
how do i initialize sysinfo
GeneralRe: Collect remote computer infomemberPIEBALDconsult26 Dec '12 - 16:07 
With a new statement.
GeneralRe: Collect remote computer infomvpDave Kreskowiak26 Dec '12 - 16:09 
You SERIOUSLY need to pickup a beginners book on C# an d work through it.
 
If your code, you need to add the line:
sysinfo = new SysInfo();
to the Form_Load method.
 
SERIOUSLY, pickup a book! You desperately need it.

GeneralRe: Collect remote computer infomemberMember 970663327 Dec '12 - 9:09 
i had refer but unfortunate fail.
Dear Exprt,
 
Would mine to guide to archive this on button.
GeneralRe: Collect remote computer infomvpDave Kreskowiak27 Dec '12 - 11:00 
Uhhh...WHAT??

Questionhowba3634@yahoo.commembersherif@198026 Dec '12 - 8:47 
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
 
public partial class Templates_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Bitmap myBitmap = new Bitmap("D:\\WebSite1\\image\\egy111.jpg");
        Graphics g = Graphics.FromImage(myBitmap);
        g.DrawString("My\nText", new Font("Tahoma", 1000), Brushes.Red, new PointF(340,500));
 

    }
}
why this code don't work in web application
AnswerRe: howba3634@yahoo.commemberEddy Vluggen26 Dec '12 - 12:09 
Meh..
  1. Your subject-line does not give me a clue about the problem;
  2. Don't post your mail-address unless you "need" spam
  3. "Does not work" doesn't explain anything. Include the full error-message
  4. Read up on the Dispose-method
It does not work because the webserver isn't allowed to read from your D-drive using the current credentials.
Bastard Programmer from Hell Suspicious | :suss:
If you can't read my code, try converting it here[^]
They hate us for our freedom![^]

AnswerRe: howba3634@yahoo.commemberProgramFOX28 Dec '12 - 4:27 
Because it's a web application, not a Windows application. Add a reference to System.Drawing.dll, and this code will compile.
In some cases, my signature will be longer then my message...
<em style="color:red">ProgramFOX</em>
ProgramFOX

Questionhowba3634membersherif@198026 Dec '12 - 8:46 
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
 
public partial class Templates_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Bitmap myBitmap = new Bitmap("D:\\WebSite1\\image\\egy111.jpg");
        Graphics g = Graphics.FromImage(myBitmap);
        g.DrawString("My\nText", new Font("Tahoma", 1000), Brushes.Red, new PointF(340,500));
 

    }
}
why this code don't work in web application
AnswerRe: howba3634memberEddy Vluggen26 Dec '12 - 12:09 
and don't post the same friggin' question twice, unless you want me to repeat the answer.
Bastard Programmer from Hell Suspicious | :suss:
If you can't read my code, try converting it here[^]
They hate us for our freedom![^]

QuestionAutoComplete Like Visual Studio??memberGuilherme Lopes26 Dec '12 - 2:03 
Hi Everone,
I´m looking for a implementantion or a code or even a Tip to implement one Autocomplete (intellisense) like visual studio. For example:
 
If you tipe DT in caps letters in visual Studio they suggest DateTime and any other item wich contains D in begining and T in the middle. in capital letter. It´s amazing, I really want to put this in a WindowsForms application.
 
Thanks in advance!
AnswerRe: AutoComplete Like Visual Studio??membersirama200426 Dec '12 - 2:19 
I don't know that it is possible like you specified (D******T***). But it is possible doing auto complete for Da******.
Refer this Link[^]

GeneralRe: AutoComplete Like Visual Studio??memberGuilherme Morais26 Dec '12 - 2:57 
Thanks Sirama, I´m thiking here, I could try to search if the letter is upper case, like D%T%...
I will try this later, thanks.
QuestionCan some one port this java code to c#?memberDanish Samil25 Dec '12 - 23:29 
private static final java.text.Collator COLLATOR = java.text.Collator.getInstance();
 
private static final String[] NORM_STRINGS = new String['z' - 'a' + 1];
{
  COLLATOR.setStrength(Collator.PRIMARY);
  for (char b = 'a'; b <= 'z'; b++)
  {
      NORM_STRINGS[b - 'a'] = new String(new char[] { b });
  }
}

AnswerRepost from Java forummemberProgramFOX26 Dec '12 - 0:37 
Repost from Java forum[^]
Please post a question in one forum.
In some cases, my signature will be longer then my message...
<em style="color:red">ProgramFOX</em>
ProgramFOX

Questionhow to populate wpf datagridcomboboxcolumn with arraylist values, which is not static?memberMember 967842725 Dec '12 - 2:20 
Hi, I have tried all sorts of help provided over the internet and couldn't manage to populate the wpf datagridcomboboxcolumn with collection of values from arraylist.
 
Following is my code:
 
XAML:
<DataGridComboBoxColumn Header="Rooms" Width="*" ItemsSource="{Binding Path=SwitchesList}" SelectedItemBinding="{Binding Path=room}" ></DataGridComboBoxColumn>
 

CODE BEHIND:
private ArrayList arrSwitches;
        public ArrayList SwitchesList
        {
            get { return arrSwitches; }
            set
            {
                arrSwitches = adb.getSwitchList(switchtype);
            }
        }
;
 
What am I doing wrong here?
 
Thanks in advance.
AnswerRe: how to populate wpf datagridcomboboxcolumn with arraylist values, which is not static?memberEddy Vluggen26 Dec '12 - 12:11 
Member 9678427 wrote:
What am I doing wrong here?

..assuming that it'll be filled, because the getter is called. It will not be initialized, unless "set". This should have been a read-only property, initialized in the constructor.
Bastard Programmer from Hell Suspicious | :suss:
If you can't read my code, try converting it here[^]
They hate us for our freedom![^]

Questioncode for speech to text using csharp .netmemberdolly papa24 Dec '12 - 20:36 
can you tell the code for converting speech to text using csharp .net?
AnswerRe: code for speech to text using csharp .netmvpRichard MacCutchan24 Dec '12 - 23:02 
Take your pick[^].
One of these days I'm going to think of a really clever signature.

AnswerRe: code for speech to text using csharp .netmemberProgramFOX24 Dec '12 - 23:13 
Hi,
 
Have a look here:
Speech recognition in C#[^]
C# Speech to Text[^]
In some cases, my signature will be longer then my message...
<em style="color:red">ProgramFOX</em>
ProgramFOX

QuestionHow to modify a line in the Word file using C# ?membertaibc24 Dec '12 - 20:04 
Hi,
 
I have a word file. And I am trying to modify the content of this file by using C# (via Microsoft.Office.Interop.Word).
 
For example: My file includes the below lines:
 
"Full name: ....
 
Address: ....
 
City: .... "
 
And, I want to change the "full name" and "city" to :
 
"Full name: John Markery
 
Address: ....
 
City: London"
 
How can I do that ?
 
Thanks and regards,
AnswerRe: How to modify a line in the Word file using C# ?mvpRichard MacCutchan24 Dec '12 - 23:04 
You need to use the Microsoft.Office.Interop.Word Namespace[^].
One of these days I'm going to think of a really clever signature.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 19 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid